Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F386254
Unit.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Size
1 KB
Referenced Files
None
Subscribers
None
Unit.cpp
View Options
#include
"rosa/core/Unit.h"
#include
"rosa/support/debug.hpp"
#include
"rosa/support/log.h"
namespace
rosa
{
// Zero-initialized definitions of static members.
// NOTE: Initialization is not atomic.
std
::
atomic
<
uint64_t
>
Unit
::
CountUnits
(
0
);
std
::
atomic
<
uint64_t
>
Unit
::
LiveUnits
(
0
);
// Ctor. Incrementing static counters and initializing member fields.
Unit
::
Unit
(
const
std
::
string
&
Name
)
noexcept
:
Id
(
++
CountUnits
),
Name
(
Name
.
empty
()
?
"Unit_"
+
std
::
to_string
(
Id
)
:
Name
)
{
LOG_TRACE
(
"Constructing Unit ("
+
this
->
Name
+
")"
);
++
LiveUnits
;
}
// Dtor. Decrementing static live counter.
Unit
::~
Unit
(
void
)
noexcept
{
LOG_TRACE
(
"Destroying Unit ("
+
Name
+
")"
);
--
LiveUnits
;
ASSERT
(
LiveUnits
>=
0
);
}
// Default dump function, emitting the Name of the Unit.
std
::
string
Unit
::
dump
(
void
)
const
noexcept
{
LOG_TRACE
(
"Dumping Unit ("
+
Name
+
")"
);
return
"[Unit] "
+
Name
;
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
Unit
&
unit
)
{
os
<<
unit
.
dump
();
return
os
;
}
}
// End namespace rosa
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Wed, Jul 2, 4:53 AM (9 h, 3 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
157112
Default Alt Text
Unit.cpp (1 KB)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline
Log In to Comment