Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
reporting
FileReporting.cpp
Go to the documentation of this file.
1
2
#include "
FileReporting.hpp
"
3
#include <
rtt/RTT.hpp
>
4
#include <
rtt/Logger.hpp
>
5
#include "
TableMarshaller.hpp
"
6
#include "
NiceHeaderMarshaller.hpp
"
7
8
9
#include "
ocl/Component.hpp
"
10
ORO_LIST_COMPONENT_TYPE
(
OCL::FileReporting
)
11
12
namespace
OCL
13
{
14
using namespace
RTT
;
15
using namespace
std
;
16
17
FileReporting::FileReporting(
const
std::string& fr_name)
18
:
ReportingComponent
( fr_name ),
19
repfile(
"ReportFile"
,
"Location on disc to store the reports."
,
"reports.dat"
)
20
{
21
this->
properties
()->
addProperty
(
repfile
);
22
}
23
24
bool
FileReporting::startHook
()
25
{
26
mfile
.open(
repfile
.
get
().c_str() );
27
if
(
mfile
) {
28
if
( this->
writeHeader
)
29
fheader
=
new
RTT::NiceHeaderMarshaller<std::ostream>
(
mfile
);
30
else
31
fheader
= 0;
32
fbody
=
new
RTT::TableMarshaller<std::ostream>
(
mfile
);
33
34
this->
addMarshaller
( fheader,
fbody
);
35
}
else
{
36
log(
Error
) <<
"Could not open file "
+
repfile
.
get
()+
" for reporting."
<<endlog();
37
}
38
39
return
ReportingComponent::startHook
();
40
}
41
42
void
FileReporting::stopHook
()
43
{
44
ReportingComponent::stopHook
();
45
46
this->
removeMarshallers
();
47
if
(
mfile
)
48
mfile
.close();
49
}
50
51
bool
FileReporting::screenComponent
(
const
std::string& comp)
52
{
53
Logger::In in(
"FileReporting::screenComponent"
);
54
ofstream file( (comp +
".screen"
).c_str() );
55
if
(!file)
56
return
false
;
57
return
this->
screenImpl
( comp, file );
58
}
59
60
}
OCL::FileReporting::fheader
RTT::marsh::MarshallInterface * fheader
Definition:
FileReporting.hpp:28
RTT::Property::get
DataSourceType get() const
OCL::FileReporting::mfile
std::ofstream mfile
Definition:
FileReporting.hpp:26
OCL::ReportingComponent::addMarshaller
bool addMarshaller(RTT::marsh::MarshallInterface *headerM, RTT::marsh::MarshallInterface *bodyM)
Definition:
ReportingComponent.cpp:218
OCL::ReportingComponent::startHook
virtual bool startHook()
Definition:
ReportingComponent.cpp:543
OCL::FileReporting::stopHook
void stopHook()
Definition:
FileReporting.cpp:42
NiceHeaderMarshaller.hpp
FileReporting.hpp
OCL::ReportingComponent::writeHeader
RTT::Property< bool > writeHeader
Definition:
ReportingComponent.hpp:239
std
OCL::FileReporting::repfile
RTT::Property< std::string > repfile
Definition:
FileReporting.hpp:21
Logger.hpp
OCL::FileReporting::startHook
bool startHook()
Definition:
FileReporting.cpp:24
OCL::FileReporting
Definition:
FileReporting.hpp:14
Component.hpp
OCL::FileReporting::screenComponent
bool screenComponent(const std::string &comp)
Definition:
FileReporting.cpp:51
RTT::PropertyBag::addProperty
Property< T > & addProperty(const std::string &name, T &attr)
OCL::ReportingComponent::removeMarshallers
bool removeMarshallers()
Definition:
ReportingComponent.cpp:233
OCL::ReportingComponent::stopHook
virtual void stopHook()
Definition:
ReportingComponent.cpp:694
OCL
Definition:
deployer-funcs.cpp:68
RTT::NiceHeaderMarshaller
Definition:
NiceHeaderMarshaller.hpp:55
Error
Error
OCL::ReportingComponent::screenImpl
bool screenImpl(const std::string &comp, std::ostream &output)
Definition:
ReportingComponent.cpp:310
OCL::ReportingComponent
A Component for periodically reporting Component Port contents to a human readable text format...
Definition:
ReportingComponent.hpp:81
ORO_LIST_COMPONENT_TYPE
ORO_LIST_COMPONENT_TYPE(OCL::logging::Appender)
RTT::TableMarshaller
Definition:
TableMarshaller.hpp:56
RTT::TaskContext::properties
PropertyBag * properties()
OCL::FileReporting::fbody
RTT::marsh::MarshallInterface * fbody
Definition:
FileReporting.hpp:29
RTT
RTT.hpp
TableMarshaller.hpp
ocl
Author(s): OCL Development Team
autogenerated on Wed Jun 26 2019 19:26:27