Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F86095958
lm_object.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Oct 4, 06:21
Size
2 KB
Mime Type
text/x-c
Expires
Sun, Oct 6, 06:21 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
21344324
Attached To
rLIBMULTISCALE LibMultiScale
lm_object.cc
View Options
#include "lm_object.hh"
#include "lm_communicator.hh"
/* -------------------------------------------------------------------------- */
#include <ctime>
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
int
LMObject
::
random_release
()
{
// std::srand(std::time(nullptr));
return
std
::
rand
();
}
/* -------------------------------------------------------------------------- */
LMObject
::
LMObject
(
const
LMID
&
id
)
:
id
(
id
),
comm_group
(
nullptr
)
{
release
=
random_release
();
}
/* -------------------------------------------------------------------------- */
const
LMID
&
LMObject
::
getID
()
const
{
return
id
;
}
/* -------------------------------------------------------------------------- */
void
LMObject
::
setID
(
const
LMID
&
id
)
{
this
->
id
=
id
;
}
/* -------------------------------------------------------------------------- */
void
LMObject
::
setCommGroup
(
CommGroup
&
group
)
{
comm_group
=
&
group
;
}
/* -------------------------------------------------------------------------- */
CommGroup
&
LMObject
::
getCommGroup
()
const
{
if
(
comm_group
==
nullptr
)
return
Communicator
::
getCommunicator
().
getGroup
(
"self"
);
return
*
comm_group
;
}
/* -------------------------------------------------------------------------- */
void
LMObject
::
acquireContext
(
const
LMObject
&
obj
)
{
this
->
setCommGroup
(
obj
.
getCommGroup
());
this
->
setRelease
(
obj
.
release
);
}
/* -------------------------------------------------------------------------- */
UInt
LMObject
::
getRelease
()
const
{
return
release
;
}
/* -------------------------------------------------------------------------- */
void
LMObject
::
setRelease
(
UInt
r
)
{
release
=
r
;
}
/* -------------------------------------------------------------------------- */
// void LMObject::incRelease() { ++release; }
/* -------------------------------------------------------------------------- */
void
LMObject
::
changeRelease
()
{
release
=
random_release
();
}
__END_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
Event Timeline
Log In to Comment