CFEL - ASG Software Suite  2.5.0
CASS
Classes | Typedefs | Functions
zmq_input.cpp File Reference

contains input that uses ZMQ as interface More...

#include <iostream>
#include <zmq.hpp>
#include <msgpack.hpp>
#include "zmq_input.h"
#include "cass_settings.h"
#include "cass_exceptions.hpp"
#include "log.h"
#include "acqiris_device.hpp"
#include "pixeldetector.hpp"
#include "machine_device.hpp"
+ Include dependency graph for zmq_input.cpp:

Go to the source code of this file.

Classes

struct  Info
 define a structure that holds information about how to parse and extract the info contained in a msgpack object. More...
 

Typedefs

typedef std::map< std::string, Infoextractmap_t
 

Functions

template<typename type >
void readNDArrayDataAsString (std::vector< float > &out, const msgpack::object &obj)
 read the string like payload of an msgpack object into an vector of floats More...
 
template<typename type >
void readNDArrayDataAsBinary (std::vector< float > &out, const msgpack::object &obj)
 read the binary payload of an msgpack object into an vector of floats More...
 
bool iterate (const msgpack::object &obj, int depth, extractmap_t &emap, string acckey="")
 

Detailed Description

contains input that uses ZMQ as interface

Author
Lutz Foucar

Definition in file zmq_input.cpp.

Typedef Documentation

typedef std::map<std::string,Info> extractmap_t

Definition at line 97 of file zmq_input.cpp.

Function Documentation

bool iterate ( const msgpack::object &  obj,
int  depth,
extractmap_t emap,
string  acckey = "" 
)

just go through the msgpack object and

separate the keys of the nested dictionaries by a '$' character

check if we're interested in the data

get a reference to the info that will now attempt to fill.

check if its ndarray data

if it is then extract the shape and the data according to the type of the data an how it is packed

check if its an array

check if its a single data value

if we are not interested in the data then just check to see if its another map that we should iterate into

Definition at line 132 of file zmq_input.cpp.

References cass::Log::add(), Info::data, info, Info::shape, and cass::Log::WARNING.

Referenced by cass::XtcIterator::process(), and cass::ZMQInput::runthis().

template<typename type >
void readNDArrayDataAsBinary ( std::vector< float > &  out,
const msgpack::object &  obj 
)

read the binary payload of an msgpack object into an vector of floats

Template Parameters
typethe type of data wrapped in the msgpack object as string
Parameters
outreference to the vector where the data will be written to
objthe msgpack object who's payload will be written to the out vector
Author
Lutz Foucar

Definition at line 125 of file zmq_input.cpp.

template<typename type >
void readNDArrayDataAsString ( std::vector< float > &  out,
const msgpack::object &  obj 
)

read the string like payload of an msgpack object into an vector of floats

Template Parameters
typethe type of data wrapped in the msgpack object as string
Parameters
outreference to the vector where the data will be written to
objthe msgpack object who's payload will be written to the out vector
Author
Lutz Foucar

Definition at line 109 of file zmq_input.cpp.