Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aevol-eukaryotes
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LUISELLI Juliette
aevol-eukaryotes
Commits
e2f74ab8
Commit
e2f74ab8
authored
1 year ago
by
David Parsons
Browse files
Options
Downloads
Patches
Plain Diff
reformat DnaFactory.h
parent
d9667c38
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libaevol/7/DnaFactory.h
+56
-55
56 additions, 55 deletions
src/libaevol/7/DnaFactory.h
with
56 additions
and
55 deletions
src/libaevol/7/DnaFactory.h
+
56
−
55
View file @
e2f74ab8
...
@@ -33,76 +33,77 @@
...
@@ -33,76 +33,77 @@
#include
<vector>
#include
<vector>
namespace
aevol
{
namespace
aevol
{
enum
DnaFactory_Policy
{
FIRST
=
0
,
FIRSTFIT
=
1
,
BESTFIT
=
2
,
LOCAL_GLOBAL_FIT
=
3
,
ALLOCATE
=
4
};
enum
DnaFactory_Garbage_Policy
{
enum
DnaFactory_Policy
{
MAXSIZE
=
0
,
FIRST
=
0
,
MAXMEM
=
1
FIRSTFIT
=
1
,
};
BESTFIT
=
2
,
LOCAL_GLOBAL_FIT
=
3
,
ALLOCATE
=
4
};
class
ExpManager_7
;
enum
DnaFactory_Garbage_Policy
{
MAXSIZE
=
0
,
MAXMEM
=
1
};
class
DnaFactory
{
class
ExpManager_7
;
public:
DnaFactory
(
DnaFactory_Policy
policy
,
int
pool_size
,
int
init_size
,
int
pop_size
=
-
1
)
{
policy_
=
policy
;
pool_size_
=
pool_size
;
// printf("Pool init \n");
init
(
init_size
,
pop_size
);
}
~
DnaFactory
()
{
class
DnaFactory
{
for
(
auto
&&
it_dna
:
list_unused_dna_
)
{
public:
delete
it_dna
;
DnaFactory
(
DnaFactory_Policy
policy
,
int
pool_size
,
int
init_size
,
int
pop_size
=
-
1
)
{
}
policy_
=
policy
;
list_unused_dna_
.
clear
();
pool_size_
=
pool_size
;
// printf("Pool init \n");
init
(
init_size
,
pop_size
);
}
for
(
size_t
j
=
0
;
j
<
local_list_unused_dna_
.
size
();
j
++
)
{
~
DnaFactory
()
{
for
(
auto
&&
it_dna
:
local_list_unused_dna_
[
j
])
{
for
(
auto
&&
it_dna
:
list_unused_dna_
)
{
delete
it_dna
;
delete
it_dna
;
}
}
local_list_unused_dna_
[
j
].
clear
();
list_unused_dna_
.
clear
();
}
local_list_unused_dna_
.
clear
();
}
for
(
size_t
j
=
0
;
j
<
local_list_unused_dna_
.
size
();
j
++
)
{
for
(
auto
&&
it_dna
:
local_list_unused_dna_
[
j
])
{
delete
it_dna
;
}
local_list_unused_dna_
[
j
].
clear
();
}
local_list_unused_dna_
.
clear
();
}
void
init
(
int
init_size
,
int
pop_size
=
-
1
);
void
init
(
int
init_size
,
int
pop_size
=
-
1
);
Dna_7
*
get_dna
(
int
request_size
);
Dna_7
*
get_dna
(
int
request_size
);
void
give_back
(
Dna_7
*
dna
);
void
give_back
(
Dna_7
*
dna
);
void
reduce_space
(
ExpManager_7
*
exp_m
);
void
reduce_space
(
ExpManager_7
*
exp_m
);
const
static
int32_t
cleanup_step
=
100
;
const
static
int32_t
cleanup_step
=
100
;
const
static
DnaFactory_Garbage_Policy
garbage_policy
=
DnaFactory_Garbage_Policy
::
MAXMEM
;
const
static
DnaFactory_Garbage_Policy
garbage_policy
=
DnaFactory_Garbage_Policy
::
MAXMEM
;
private
:
private
:
std
::
list
<
Dna_7
*>
list_unused_dna_
;
std
::
list
<
Dna_7
*>
list_unused_dna_
;
std
::
vector
<
std
::
list
<
Dna_7
*>>
local_list_unused_dna_
;
std
::
vector
<
std
::
list
<
Dna_7
*>>
local_list_unused_dna_
;
DnaFactory_Policy
policy_
;
DnaFactory_Policy
policy_
;
int
pool_size_
;
int
pool_size_
;
int
global_pool_size_
=
256
;
int
global_pool_size_
=
256
;
size_t
local_pool_size_
=
256
;
size_t
local_pool_size_
=
256
;
size_t
max_pool_size
=
16000
;
size_t
max_pool_size
=
16000
;
// int empty_global = 0;
// int empty_global = 0;
// int local_empty = 0;
// int local_empty = 0;
// int free_space_local = 0;
// int free_space_local = 0;
// int free_local = 0;
// int free_local = 0;
// int free_global = 0;
// int free_global = 0;
};
};
}
}
// namespace aevol
#endif //AEVOL_DNAFACTORY_H
#endif //AEVOL_DNAFACTORY_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment