10#ifndef logger_types_telem_blockgains_hpp
11#define logger_types_telem_blockgains_hpp
40 const std::vector<float> &
mcs,
42 const std::vector<float> &
lims,
64 static_cast<size_t>( len ) );
73 static_cast<void>( len );
77 std::string msg =
"[gains] ";
80 if( fbs->gains() && fbs->gains_constant() )
82 if( fbs->gains()->size() == fbs->gains_constant()->size() )
84 for(
size_t i = 0; i < fbs->gains()->size(); ++i )
87 msg += std::to_string( fbs->gains()->Get( i ) );
89 msg += std::to_string( fbs->gains_constant()->Get( i ) );
95 for(
size_t i = 0; i < fbs->gains()->size(); ++i )
98 msg += std::to_string( fbs->gains()->Get( i ) );
103 else if( fbs->gains() )
105 for(
size_t i = 0; i < fbs->gains()->size(); ++i )
108 msg += std::to_string( fbs->gains()->Get( i ) );
114 if( fbs->mcs() && fbs->mcs_constant() )
116 if( fbs->mcs()->size() == fbs->mcs_constant()->size() )
118 for(
size_t i = 0; i < fbs->mcs()->size(); ++i )
121 msg += std::to_string( fbs->mcs()->Get( i ) );
123 msg += std::to_string( fbs->mcs_constant()->Get( i ) );
129 for(
size_t i = 0; i < fbs->mcs()->size(); ++i )
132 msg += std::to_string( fbs->mcs()->Get( i ) );
137 else if( fbs->mcs() )
139 for(
size_t i = 0; i < fbs->mcs()->size(); ++i )
142 msg += std::to_string( fbs->mcs()->Get( i ) );
149 if( fbs->lims() && fbs->lims_constant() )
151 if( fbs->lims()->size() == fbs->lims_constant()->size() )
153 for(
size_t i = 0; i < fbs->lims()->size(); ++i )
156 msg += std::to_string( fbs->lims()->Get( i ) );
158 msg += std::to_string( fbs->lims_constant()->Get( i ) );
164 for(
size_t i = 0; i < fbs->lims()->size(); ++i )
167 msg += std::to_string( fbs->lims()->Get( i ) );
172 else if( fbs->lims() )
174 for(
size_t i = 0; i < fbs->lims()->size(); ++i )
177 msg += std::to_string( fbs->lims()->Get( i ) );
185 static std::vector<float>
gains(
void *msgBuffer )
187 std::vector<float> p;
191 if( fbs->gains() !=
nullptr )
193 for(
auto it = fbs->gains()->begin(); it != fbs->gains()->end(); ++it )
201 static std::vector<bool>
208 if( fbs->gains_constant() !=
nullptr )
210 for(
auto it = fbs->gains_constant()->begin(); it != fbs->gains_constant()->end(); ++it )
218 static std::vector<float>
mcs(
void *msgBuffer )
220 std::vector<float> p;
224 if( fbs->mcs() !=
nullptr )
226 for(
auto it = fbs->mcs()->begin(); it != fbs->mcs()->end(); ++it )
234 static std::vector<bool>
241 if( fbs->mcs_constant() !=
nullptr )
243 for(
auto it = fbs->mcs_constant()->begin(); it != fbs->mcs_constant()->end(); ++it )
251 static std::vector<float>
lims(
void *msgBuffer )
253 std::vector<float> p;
257 if( fbs->lims() !=
nullptr )
259 for(
auto it = fbs->lims()->begin(); it != fbs->lims()->end(); ++it )
267 static std::vector<bool>
274 if( fbs->lims_constant() !=
nullptr )
276 for(
auto it = fbs->lims_constant()->begin(); it != fbs->lims_constant()->end(); ++it )
291 if( member ==
"gains" )
296 reinterpret_cast<void *
>( &
gains ),
298 else if( member ==
"gains_constant" )
300 "whether or not all modes have same gain in block",
305 else if( member ==
"mcs" )
307 "mode block mult. coefs.",
310 reinterpret_cast<void *
>( &
mcs ),
312 else if( member ==
"mcs_constant" )
314 "whether or not all modes have same mult. coefs. in block",
319 else if( member ==
"lims" )
324 reinterpret_cast<void *
>( &
lims ),
326 else if( member ==
"lims_constant" )
328 "whether or not all modes have same limit in block",
335 std::cerr <<
"No member " << member <<
" in telem_blockgains\n";
The MagAO-X logger flatbuffer log base type.
uint16_t eventCodeT
The type of an event code (16-bit unsigned int).
msgLen2T msgLenT
The type used to refer to the message length, regardless of length.
int8_t logPrioT
The type of the log priority code.
static void * messageBuffer(bufferPtrT &logBuffer)
Get the message buffer address.
std::shared_ptr< char > bufferPtrT
The log entry buffer smart pointer.
static constexpr flatlogs::eventCodeT TELEM_BLOCKGAINS
inline ::flatbuffers::Offset< Telem_blockgains_fb > CreateTelem_blockgains_fb(::flatbuffers::FlatBufferBuilder &_fbb, ::flatbuffers::Offset<::flatbuffers::Vector< float > > gains=0, ::flatbuffers::Offset<::flatbuffers::Vector< uint8_t > > gains_constant=0, ::flatbuffers::Offset<::flatbuffers::Vector< float > > mcs=0, ::flatbuffers::Offset<::flatbuffers::Vector< uint8_t > > mcs_constant=0, ::flatbuffers::Offset<::flatbuffers::Vector< float > > lims=0, ::flatbuffers::Offset<::flatbuffers::Vector< uint8_t > > lims_constant=0)
bool VerifyTelem_blockgains_fbBuffer(::flatbuffers::Verifier &verifier)
const MagAOX::logger::Telem_blockgains_fb * GetTelem_blockgains_fb(const void *buf)
static constexpr logPrioT LOG_TELEM
A telemetry recording.
Message type for resolving log messages with a f.b. builder.
flatbuffers::FlatBufferBuilder builder
Base class for logs consisting of a flatbuffer message.
The type of the input message.
messageT(const std::vector< float > &gains, const std::vector< uint8_t > &gains_constant, const std::vector< float > &mcs, const std::vector< uint8_t > &mcs_constant, const std::vector< float > &lims, const std::vector< uint8_t > &lims_constant)
Construct from components.
Log entry recording electronics rack temperature.
static timespec lastRecord
The time of the last time this log was recorded. Used by the telemetry system.
static std::vector< bool > gains_constant(void *msgBuffer)
static logMetaDetail getAccessor(const std::string &member)
Get the logMetaDetail for a member by name.
static std::string msgString(void *msgBuffer, flatlogs::msgLenT len)
Get the message formatte for human consumption.
static std::vector< float > lims(void *msgBuffer)
static std::vector< bool > mcs_constant(void *msgBuffer)
static std::vector< float > gains(void *msgBuffer)
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)
static const flatlogs::logPrioT defaultLevel
The default level.
static const flatlogs::eventCodeT eventCode
The event code.
static std::vector< bool > lims_constant(void *msgBuffer)
static std::vector< float > mcs(void *msgBuffer)