Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F85837777
lm_object.hh
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
Wed, Oct 2, 11:02
Size
1 KB
Mime Type
text/x-c++
Expires
Fri, Oct 4, 11:02 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
21280147
Attached To
rLIBMULTISCALE LibMultiScale
lm_object.hh
View Options
#ifndef __LIBMULTISCALE_LM_OBJECT_HH__
#define __LIBMULTISCALE_LM_OBJECT_HH__
/* -------------------------------------------------------------------------- */
#include "auto_arguments.hh"
#include "lm_common.hh"
#include "lm_globals.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
struct
CommGroup
;
/* -------------------------------------------------------------------------- */
using
dispatch
=
AutoDispatch
::
dispatch
;
template
<
typename
T
,
typename
...
Ts
>
using
enable_if_type
=
AutoDispatch
::
enable_if_type
<
T
,
Ts
...
>
;
/* -------------------------------------------------------------------------- */
/**
* Class LMObject
* objects having an ID
*/
class
LMObject
:
public
AutoDispatch
::
Argument
{
public
:
LMObject
(
const
LMID
&
id
)
:
id
(
id
),
comm_group
(
nullptr
){};
virtual
const
LMID
&
getID
()
const
{
return
id
;
};
virtual
void
setID
(
const
LMID
&
id
)
{
this
->
id
=
id
;
};
//! set the communication group
virtual
void
setCommGroup
(
CommGroup
&
group
)
{
comm_group
=
&
group
;
};
//! return the communication group
CommGroup
&
getCommGroup
()
const
{
if
(
comm_group
==
nullptr
)
LM_FATAL
(
"invalid group"
);
return
*
comm_group
;
};
virtual
void
acquireContext
(
const
LMObject
&
obj
)
{
this
->
setCommGroup
(
obj
.
getCommGroup
());
this
->
setRelease
(
std
::
max
(
obj
.
release
,
release
));
}
//! return actual release
UInt
getRelease
()
const
{
return
release
;
};
//! return actual release
void
setRelease
(
UInt
r
)
{
release
=
r
;
};
//! increment the release
void
incRelease
()
{
++
release
;
};
private
:
//! general id
LMID
id
;
//! general release number
UInt
release
=
0
;
protected
:
CommGroup
*
comm_group
;
};
__END_LIBMULTISCALE__
#endif
// __LIBMULTISCALE_LM_OBJECT_HH__
Event Timeline
Log In to Comment