Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
b91493e7
Commit
b91493e7
authored
Jan 10, 2019
by
Micha Mueller
Browse files
Add copy constr and assignment op to BACnet, IPMI, opa plugins
parent
1d684738
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/sensors/bacnet/BACnetSensorBase.h
View file @
b91493e7
...
...
@@ -25,8 +25,26 @@ public:
_objectIndex
=
BACNET_ARRAY_ALL
;
}
BACnetSensorBase
(
const
BACnetSensorBase
&
other
)
:
SensorBase
(
other
),
_factor
(
other
.
_factor
),
_objectInstance
(
other
.
_objectInstance
),
_objectType
(
other
.
_objectType
),
_propertyId
(
other
.
_propertyId
),
_objectIndex
(
other
.
_objectIndex
)
{}
virtual
~
BACnetSensorBase
()
{}
BACnetSensorBase
&
operator
=
(
const
BACnetSensorBase
&
other
)
{
SensorBase
::
operator
=
(
other
);
_factor
=
other
.
_factor
;
_objectInstance
=
other
.
_objectInstance
;
_objectType
=
other
.
_objectType
;
_propertyId
=
other
.
_propertyId
;
_objectIndex
=
other
.
_objectIndex
;
return
*
this
;
}
double
getFactor
()
const
{
return
_factor
;
}
uint32_t
getObjectInstance
()
const
{
return
_objectInstance
;
}
BACNET_OBJECT_TYPE
getObjectType
()
const
{
return
_objectType
;
}
...
...
src/sensors/bacnet/BACnetSensorGroup.cpp
View file @
b91493e7
...
...
@@ -11,11 +11,22 @@
BACnetSensorGroup
::
BACnetSensorGroup
(
const
std
::
string
&
name
)
:
SensorGroupTemplate
(
name
),
_deviceInstance
(
0
)
{
_bacClient
=
nullptr
;
}
BACnetSensorGroup
::
BACnetSensorGroup
(
const
BACnetSensorGroup
&
other
)
:
SensorGroupTemplate
(
other
),
_bacClient
(
other
.
_bacClient
),
_deviceInstance
(
other
.
_deviceInstance
)
{}
BACnetSensorGroup
::~
BACnetSensorGroup
()
{}
BACnetSensorGroup
&
BACnetSensorGroup
::
operator
=
(
const
BACnetSensorGroup
&
other
)
{
SensorGroupTemplate
::
operator
=
(
other
);
_bacClient
=
other
.
_bacClient
;
_deviceInstance
=
other
.
_deviceInstance
;
return
*
this
;
}
void
BACnetSensorGroup
::
init
(
boost
::
asio
::
io_service
&
io
)
{
SensorGroupTemplate
::
init
(
io
);
if
(
_bacClient
)
{
...
...
src/sensors/bacnet/BACnetSensorGroup.h
View file @
b91493e7
...
...
@@ -17,7 +17,9 @@ class BACnetSensorGroup: public SensorGroupTemplate<BACnetSensorBase> {
public:
BACnetSensorGroup
(
const
std
::
string
&
name
);
BACnetSensorGroup
(
const
BACnetSensorGroup
&
other
);
virtual
~
BACnetSensorGroup
();
BACnetSensorGroup
&
operator
=
(
const
BACnetSensorGroup
&
other
);
void
init
(
boost
::
asio
::
io_service
&
io
)
override
;
void
start
()
override
;
...
...
src/sensors/ipmi/IPMISensorBase.h
View file @
b91493e7
...
...
@@ -25,7 +25,26 @@ public:
_start
(
0
),
_stop
(
0
)
{}
virtual
~
IPMISensorBase
()
{
IPMISensorBase
(
const
IPMISensorBase
&
other
)
:
SensorBase
(
other
),
_recordId
(
other
.
_recordId
),
_sdrRecord
(
other
.
_sdrRecord
),
_factor
(
other
.
_factor
),
_rawCmd
(
other
.
_rawCmd
),
_start
(
other
.
_start
),
_stop
(
other
.
_stop
)
{}
virtual
~
IPMISensorBase
()
{}
IPMISensorBase
&
operator
=
(
const
IPMISensorBase
&
other
)
{
SensorBase
::
operator
=
(
other
);
_recordId
=
other
.
_recordId
;
_sdrRecord
=
other
.
_sdrRecord
;
_factor
=
other
.
_factor
;
_rawCmd
=
other
.
_rawCmd
;
_start
=
other
.
_start
;
_stop
=
other
.
_stop
;
return
*
this
;
}
uint16_t
getRecordId
()
const
{
return
_recordId
;
}
...
...
src/sensors/ipmi/IPMISensorGroup.cpp
View file @
b91493e7
...
...
@@ -23,8 +23,19 @@ IPMISensorGroup::IPMISensorGroup(const std::string& name) :
_host
=
nullptr
;
}
IPMISensorGroup
::
IPMISensorGroup
(
const
IPMISensorGroup
&
other
)
:
SensorGroupTemplate
(
other
),
_host
(
other
.
_host
)
{}
IPMISensorGroup
::~
IPMISensorGroup
()
{}
IPMISensorGroup
&
IPMISensorGroup
::
operator
=
(
const
IPMISensorGroup
&
other
)
{
SensorGroupTemplate
::
operator
=
(
other
);
_host
=
other
.
_host
;
return
*
this
;
}
void
IPMISensorGroup
::
init
(
boost
::
asio
::
io_service
&
io
)
{
SensorGroupTemplate
::
init
(
io
);
if
(
_host
)
{
...
...
src/sensors/ipmi/IPMISensorGroup.h
View file @
b91493e7
...
...
@@ -15,7 +15,9 @@ class IPMISensorGroup: public SensorGroupTemplate<IPMISensorBase> {
public:
IPMISensorGroup
(
const
std
::
string
&
name
);
IPMISensorGroup
(
const
IPMISensorGroup
&
other
);
virtual
~
IPMISensorGroup
();
IPMISensorGroup
&
operator
=
(
const
IPMISensorGroup
&
other
);
void
init
(
boost
::
asio
::
io_service
&
io
)
override
;
void
start
()
override
;
...
...
src/sensors/opa/OpaSensorBase.h
View file @
b91493e7
...
...
@@ -46,8 +46,18 @@ public:
SensorBase
(
name
),
_counterData
(
999
)
{}
OpaSensorBase
(
const
OpaSensorBase
&
other
)
:
SensorBase
(
other
),
_counterData
(
other
.
_counterData
)
{}
virtual
~
OpaSensorBase
()
{}
OpaSensorBase
&
operator
=
(
const
OpaSensorBase
&
other
)
{
SensorBase
::
operator
=
(
other
);
_counterData
=
other
.
_counterData
;
return
*
this
;
}
int
getCounterData
()
const
{
return
_counterData
;
}
void
setCounterData
(
int
counterData
)
{
_counterData
=
counterData
;
}
...
...
src/sensors/opa/OpaSensorGroup.cpp
View file @
b91493e7
...
...
@@ -10,9 +10,19 @@
OpaSensorGroup
::
OpaSensorGroup
(
const
std
::
string
name
)
:
SensorGroupTemplate
(
name
),
_hfiNum
(
0
),
_portNum
(
0
)
{
_port
=
nullptr
;
_imageID
=
{
0
};
_portNum
(
0
),
_port
(
nullptr
)
{
_imageId
=
{
0
};
_imageInfo
=
{
0
};
}
OpaSensorGroup
::
OpaSensorGroup
(
const
OpaSensorGroup
&
other
)
:
SensorGroupTemplate
(
other
),
_hfiNum
(
other
.
_hfiNum
),
_portNum
(
other
.
_portNum
),
_port
(
nullptr
)
{
_imageId
=
{
0
};
_imageInfo
=
{
0
};
}
OpaSensorGroup
::~
OpaSensorGroup
()
{
...
...
@@ -21,6 +31,17 @@ OpaSensorGroup::~OpaSensorGroup() {
}
}
OpaSensorGroup
&
OpaSensorGroup
::
operator
=
(
const
OpaSensorGroup
&
other
)
{
SensorGroupTemplate
::
operator
=
(
other
);
_hfiNum
=
other
.
_hfiNum
;
_portNum
=
other
.
_portNum
;
_port
=
nullptr
;
_imageId
=
{
0
};
_imageInfo
=
{
0
};
return
*
this
;
}
void
OpaSensorGroup
::
start
()
{
if
(
_keepRunning
)
{
//we have been started already
...
...
@@ -34,7 +55,7 @@ void OpaSensorGroup::start() {
return
;
}
if
(
omgt_pa_get_image_info
(
_port
,
_imageI
D
,
&
_imageInfo
))
{
if
(
omgt_pa_get_image_info
(
_port
,
_imageI
d
,
&
_imageInfo
))
{
LOG
(
error
)
<<
"Sensorgroup "
<<
_groupName
<<
" failed to get PA image"
;
omgt_close_port
(
_port
);
_port
=
nullptr
;
...
...
@@ -64,7 +85,7 @@ void OpaSensorGroup::read() {
STL_PORT_COUNTERS_DATA
portCounters
;
try
{
if
(
omgt_pa_get_port_stats
(
_port
,
_imageI
D
,
1
,
_portNum
,
&
_imageI
D
,
&
portCounters
,
NULL
,
0
,
1
))
{
if
(
omgt_pa_get_port_stats
(
_port
,
_imageI
d
,
1
,
_portNum
,
&
_imageI
d
,
&
portCounters
,
NULL
,
0
,
1
))
{
throw
std
::
runtime_error
(
"Failed to get port counters"
);
}
}
catch
(
const
std
::
exception
&
e
)
{
...
...
src/sensors/opa/OpaSensorGroup.h
View file @
b91493e7
...
...
@@ -18,7 +18,9 @@
class
OpaSensorGroup
:
public
SensorGroupTemplate
<
OpaSensorBase
>
{
public:
OpaSensorGroup
(
const
std
::
string
name
);
OpaSensorGroup
(
const
OpaSensorGroup
&
other
);
virtual
~
OpaSensorGroup
();
OpaSensorGroup
&
operator
=
(
const
OpaSensorGroup
&
other
);
void
start
()
override
;
void
stop
()
override
;
...
...
@@ -37,7 +39,7 @@ private:
uint8_t
_portNum
;
struct
omgt_port
*
_port
;
STL_PA_IMAGE_ID_DATA
_imageI
D
;
STL_PA_IMAGE_ID_DATA
_imageI
d
;
STL_PA_IMAGE_INFO_DATA
_imageInfo
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment