Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
13c5133e
Commit
13c5133e
authored
Jul 27, 2009
by
Ivan Donchevskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
in CycleStorage ViewRows is replaced by ViewRow
parent
13fb4582
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
25 deletions
+31
-25
JrnTest.cc
Utilities/JrnTests/JrnTest.cc
+20
-5
Storages.h
include/Storages.h
+2
-1
CycleStorage.cc
src/Various/CycleStorage.cc
+9
-19
No files found.
Utilities/JrnTests/JrnTest.cc
View file @
13c5133e
...
...
@@ -153,7 +153,11 @@ void testJournal1(void)
j
->
AddRow
(
str
);
}
printf
(
"
\n
first 30 elements:
\n
"
);
j
->
ViewRows
(
0
,
30
);
for
(
i
=
0
;
i
<
30
;
i
++
)
{
if
(
j
->
ViewRow
(
i
,
str
))
printf
(
"%s
\n
"
,
str
);
}
printf
(
"test of 2 classes working in 1 file together
\n
"
);
TableBlockStorage
*
t
=
new
TableBlockStorage
(
"big_file.test"
,
4
,
40
,
20000
,
5
,
28
,
0
);
...
...
@@ -169,19 +173,31 @@ void testJournal1(void)
{
j
->
DelRow
(
i
);
}
j
->
ViewRows
(
0
,
30
);
for
(
i
=
0
;
i
<
30
;
i
++
)
{
if
(
j
->
ViewRow
(
i
,
str
))
printf
(
"%s
\n
"
,
str
);
}
printf
(
"
\n
first 20 after adding 10 elements
\n
"
);
for
(
i
=
10001
;
i
<
10011
;
i
++
)
{
sprintf
(
str
,
"%d"
,
i
);
j
->
AddRow
(
str
);
}
j
->
ViewRows
(
0
,
20
);
for
(
i
=
0
;
i
<
20
;
i
++
)
{
if
(
j
->
ViewRow
(
i
,
str
))
printf
(
"%s
\n
"
,
str
);
}
printf
(
"
\n
the same after reopen:
\n
"
);
delete
j
;
j
=
new
CycleStorage
();
j
->
Open
(
"big_file.test"
,
30
,
1000000
,
20000
);
j
->
ViewRows
(
0
,
20
);
for
(
i
=
0
;
i
<
20
;
i
++
)
{
if
(
j
->
ViewRow
(
i
,
str
))
printf
(
"%s
\n
"
,
str
);
}
printf
(
"
\n
"
);
j
->
ExportToXML
(
"Xml.xml"
);
delete
t
;
...
...
@@ -197,7 +213,6 @@ void testJournal2(void)
printf
(
"journal test 2 - checking number of iterations to find head/tail
\n
"
);
printf
(
"size = %d
\n\n
"
,
j
->
size
);
printf
(
"iterations = %d
\n
"
,
j
->
iter
);
//j->ViewRows(10,20);
for
(
i
=
0
;
i
<
20
;
i
++
)
{
for
(
k
=
1000
;
k
<
3000
;
k
++
)
...
...
include/Storages.h
View file @
13c5133e
...
...
@@ -118,7 +118,8 @@ class CycleStorage
bool
AddRow
(
void
*
str
);
bool
DelRow
(
int
row
);
bool
DelAllRows
(
void
);
bool
ViewRows
(
int
beg
,
int
num
);
//bool ViewRows(int beg, int num);
void
*
ViewRow
(
int
num
,
void
*
str
);
bool
ExportToXML
(
const
char
*
name
);
};
...
...
src/Various/CycleStorage.cc
View file @
13c5133e
...
...
@@ -345,31 +345,21 @@ bool CycleStorage::DelAllRows()
return
true
;
}
bool
CycleStorage
::
ViewRows
(
int
beg
,
int
num
)
void
*
CycleStorage
::
ViewRow
(
int
num
,
void
*
str
)
{
int
i
,
j
=
(
head
+
beg
)
%
size
,
n
=
num
,
k
;
if
(
num
==
0
)
n
=
size
;
if
(
num
>
size
)
n
=
size
;
if
(
file
==
NULL
)
return
false
;
int
i
,
j
=
(
head
+
num
)
%
size
;
if
((
file
==
NULL
)
||
(
num
>
size
))
return
false
;
CycleStorageElem
*
jrn
=
(
CycleStorageElem
*
)
new
char
[
full_size
];
fseek
(
file
,
seekpos
+
j
*
full_size
,
0
);
for
(
i
=
0
;
i
<
n
;
i
++
)
fread
(
jrn
,
full_size
,
1
,
file
);
if
((
jrn
->
status
==
1
)
||
(
jrn
->
status
==
2
)
||
(
jrn
->
status
==
4
))
{
if
(
j
==
size
)
{
j
=
0
;
fseek
(
file
,
seekpos
,
0
);
}
fread
(
jrn
,
full_size
,
1
,
file
);
if
((
jrn
->
status
==
1
)
||
(
jrn
->
status
==
2
)
||
(
jrn
->
status
==
4
))
{
printf
(
"%s"
,((
char
*
)(
jrn
)
+
sizeof
(
CycleStorageElem
)));
printf
(
"
\n
"
);
}
j
++
;
memcpy
(
str
,
ValPointer
(
jrn
),
inf_size
);
delete
jrn
;
return
str
;
}
delete
jrn
;
return
true
;
return
0
;
}
bool
CycleStorage
::
ExportToXML
(
const
char
*
name
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment