Skip to content

Commit c3351ae

Browse files
authored
Merge pull request #61 from ktf/fix-warnings
Fix warnings on macOS
2 parents 46fe9c5 + 0164140 commit c3351ae

File tree

3 files changed

+94
-95
lines changed

3 files changed

+94
-95
lines changed

occ/occlib/OccServer.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include "OccServer.h"
2828

2929
#include <cstdlib>
30+
#include <cstdint>
31+
3032
#include "util/Defer.h"
3133
#include <boost/uuid/uuid_generators.hpp>
3234
#include <boost/uuid/uuid_io.hpp>
@@ -227,7 +229,7 @@ t_State OccServer::processStateTransition(const std::string& event, const boost:
227229

228230
std::string evt = boost::algorithm::to_lower_copy(event);
229231

230-
printf("Object: %s - processing event %s in state %s with run number %lu.\n",
232+
printf("Object: %s - processing event %s in state %s with run number %llu.\n",
231233
m_rco->getName().c_str(),
232234
evt.c_str(),
233235
getStringFromState(currentState).c_str(),

occ/occlib/RuntimeControlledObject.h

Lines changed: 88 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -77,96 +77,94 @@ class OCC_EXPORT RuntimeControlledObject {
7777
*/
7878
t_State getState() const;
7979

80-
/**
81-
* Transition from standby to configured.
82-
*
83-
* @param properties a boost::property_tree pushed by the control agent, containing
84-
* deployment-specific configuration (i.e. channel configuration and related).
85-
* @return 0 if the transition completed successfully, any non-zero value immediately triggers
86-
* a transition to the error state.
87-
*
88-
* The implementer should use this transition to move the machine from an unconfigured, bare
89-
* state into a state where the dataflow may be initiated at any time.
90-
* It is ok for this step to take some time if necessary.
91-
*
92-
* Example properties tree with one inbound and one outbound channel:
93-
* {
94-
* "chans": {
95-
* "myOutboundCh": {
96-
* "0": {
97-
* "address": "tcp://target.hostname.cern.ch:5555",
98-
* "method": "connect", // can be connect, bind
99-
* "type": "pull", // can be push, pull, pub, sub
100-
* "transport": "default",
101-
* "rateLogging": "0",
102-
* "sndBufSize": "1000",
103-
* "sndKernelSize": "0",
104-
* "rcvBufSize": "1000",
105-
* "rcvKernelSize": "0"
106-
* },
107-
* "numSockets": "1"
108-
* },
109-
* "myInboundCh": {
110-
* "0": {
111-
* "address": "tcp://*:5555",
112-
* "method": "bind",
113-
* "type": "push",
114-
* "transport": "default",
115-
* "rateLogging": "0",
116-
* "sndBufSize": "1000",
117-
* "sndKernelSize": "0",
118-
* "rcvBufSize": "1000",
119-
* "rcvKernelSize": "0"
120-
* },
121-
* "numSockets": "1"
122-
* }
123-
* },
124-
* "additional non-channel properties": "go here"
125-
* }
126-
*
127-
* Example of correspondence between Readout configuration file and the equivalent
128-
* reconfiguration information pushed by AliECS:
129-
*
130-
* [consumer-fmq-wp5]
131-
* # session name must match --session parameter of all O2 devices in the chain
132-
* consumerType=FairMQChannel
133-
* enabled=0
134-
* sessionName=default \
135-
* transportType=shmem \
136-
* channelName=readout-out > can be overridden in incoming tree
137-
* channelType=pair /
138-
* channelAddress=ipc:///tmp/readout-pipe-0 /
139-
* unmanagedMemorySize=2G
140-
* disableSending=0
141-
* #need also a memory pool for headers and partial HBf chunks copies
142-
* memoryPoolNumberOfPages=100
143-
* memoryPoolPageSize=128k
144-
*
145-
* Incoming tree:
146-
* {
147-
* "chans": {
148-
* "readout-out": { // should be matched against channelName
149-
* "0": {
150-
* "method": "connect", // can be connect, bind
151-
* "address": "tcp://target.hostname.cern.ch:5555", // if "method" is "bind", "address" can be e.g. "tcp://*:5555"
152-
* "type": "push", // can be push, pull, pub, sub
153-
* "transport": "shmem",
154-
* "rateLogging": "0", // additional channel options not specified in config file
155-
* "sndBufSize": "1000",
156-
* "sndKernelSize": "0",
157-
* "rcvBufSize": "1000",
158-
* "rcvKernelSize": "0"
159-
* },
160-
* "numSockets": "1" // this is always 1 because we enforce 1 connection per channel
161-
* },
162-
* },
163-
* "additional non-channel properties": "go here"
164-
* }
165-
*
166-
* @note Only one of the transition functions will be called at any given time, and during a
167-
* transition all checks (iterateRunning/iterateCheck) are blocked until the transition
168-
* finishes and returns success or error.
169-
*/
80+
/// Transition from standby to configured.
81+
///
82+
/// @param properties a boost::property_tree pushed by the control agent, containing
83+
/// deployment-specific configuration (i.e. channel configuration and related).
84+
/// @return 0 if the transition completed successfully, any non-zero value immediately triggers
85+
/// a transition to the error state.
86+
///
87+
/// The implementer should use this transition to move the machine from an unconfigured, bare
88+
/// state into a state where the dataflow may be initiated at any time.
89+
/// It is ok for this step to take some time if necessary.
90+
///
91+
/// Example properties tree with one inbound and one outbound channel:
92+
/// {
93+
/// "chans": {
94+
/// "myOutboundCh": {
95+
/// "0": {
96+
/// "address": "tcp://target.hostname.cern.ch:5555",
97+
/// "method": "connect", // can be connect, bind
98+
/// "type": "pull", // can be push, pull, pub, sub
99+
/// "transport": "default",
100+
/// "rateLogging": "0",
101+
/// "sndBufSize": "1000",
102+
/// "sndKernelSize": "0",
103+
/// "rcvBufSize": "1000",
104+
/// "rcvKernelSize": "0"
105+
/// },
106+
/// "numSockets": "1"
107+
/// },
108+
/// "myInboundCh": {
109+
/// "0": {
110+
/// "address": "tcp://*:5555",
111+
/// "method": "bind",
112+
/// "type": "push",
113+
/// "transport": "default",
114+
/// "rateLogging": "0",
115+
/// "sndBufSize": "1000",
116+
/// "sndKernelSize": "0",
117+
/// "rcvBufSize": "1000",
118+
/// "rcvKernelSize": "0"
119+
/// },
120+
/// "numSockets": "1"
121+
/// }
122+
/// },
123+
/// "additional non-channel properties": "go here"
124+
/// }
125+
///
126+
/// Example of correspondence between Readout configuration file and the equivalent
127+
/// reconfiguration information pushed by AliECS:
128+
///
129+
/// [consumer-fmq-wp5]
130+
/// # session name must match --session parameter of all O2 devices in the chain
131+
/// consumerType=FairMQChannel
132+
/// enabled=0
133+
/// sessionName=default \
134+
/// transportType=shmem \
135+
/// channelName=readout-out > can be overridden in incoming tree
136+
/// channelType=pair /
137+
/// channelAddress=ipc:///tmp/readout-pipe-0 /
138+
/// unmanagedMemorySize=2G
139+
/// disableSending=0
140+
/// #need also a memory pool for headers and partial HBf chunks copies
141+
/// memoryPoolNumberOfPages=100
142+
/// memoryPoolPageSize=128k
143+
///
144+
/// Incoming tree:
145+
/// {
146+
/// "chans": {
147+
/// "readout-out": { // should be matched against channelName
148+
/// "0": {
149+
/// "method": "connect", // can be connect, bind
150+
/// "address": "tcp://target.hostname.cern.ch:5555", // if "method" is "bind", "address" can be e.g. "tcp://*:5555"
151+
/// "type": "push", // can be push, pull, pub, sub
152+
/// "transport": "shmem",
153+
/// "rateLogging": "0", // additional channel options not specified in config file
154+
/// "sndBufSize": "1000",
155+
/// "sndKernelSize": "0",
156+
/// "rcvBufSize": "1000",
157+
/// "rcvKernelSize": "0"
158+
/// },
159+
/// "numSockets": "1" // this is always 1 because we enforce 1 connection per channel
160+
/// },
161+
/// },
162+
/// "additional non-channel properties": "go here"
163+
/// }
164+
///
165+
/// @note Only one of the transition functions will be called at any given time, and during a
166+
/// transition all checks (iterateRunning/iterateCheck) are blocked until the transition
167+
/// finishes and returns success or error.
170168
virtual int executeConfigure(const boost::property_tree::ptree& properties);
171169

172170
/**

occ/plugin/OccPluginServer.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ OccPluginServer::Transition(grpc::ServerContext* context,
358358
m_pluginServices->SetProperty(it->key(), it->value());
359359
}
360360
}
361-
catch (fair::mq::PluginServices::InvalidStateError &e) {
361+
catch (std::runtime_error &e) {
362362
OLOG(WARNING) << "[request Transition] cannot push RUN transition arguments, reason:" << e.what();
363363
}
364364
}
@@ -380,8 +380,7 @@ OccPluginServer::Transition(grpc::ServerContext* context,
380380

381381
// IF we have no states in list yet, OR
382382
// we have some states, and the last one is an intermediate state (for which an autotransition is presumably about to happen)
383-
if (newStates.empty() ||
384-
!newStates.empty() && isIntermediateState(newStates.back())) {
383+
if (newStates.empty() || isIntermediateState(newStates.back())) {
385384
// We need to block until the transitions are complete
386385
for (;;) {
387386
OLOG(DEBUG) << "[request Transition] transitions expected, blocking";
@@ -453,4 +452,4 @@ std::string OccPluginServer::generateSubscriptionId(const std::string& prefix)
453452
id = std::to_string(std::time(nullptr));
454453
}
455454
return "OCC_"s + (prefix.size() ? (prefix + "_") : "") + id;
456-
}
455+
}

0 commit comments

Comments
 (0)