ChimeraTK-DeviceAccess 03.31.00
Loading...
Searching...
No Matches
chimeratk-device-to-jmap.cc File Reference
#include "AccessMode.h"
#include "BackendFactory.h"
#include "BackendRegisterInfoBase.h"
#include "DataDescriptor.h"
#include "Device.h"
#include "RegisterCatalogue.h"
#include <nlohmann/json.hpp>
#include <boost/program_options.hpp>
#include <algorithm>
#include <fstream>
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>
+ Include dependency graph for chimeratk-device-to-jmap.cc:

Go to the source code of this file.

Functions

size_t byteSizePerElement (const ChimeraTK::DataDescriptor &descriptor, size_t stringLength)
 Return the number of bytes per single element of the given data descriptor.
 
json makeRepresentation (const ChimeraTK::DataDescriptor &descriptor)
 Build the jmap "representation" object from the generic data descriptor.
 
std::string accessString (const ChimeraTK::BackendRegisterInfoBase &info)
 Return the jmap "access" string for a register from its read/write capability.
 
void insertRegister (json &children, const std::vector< std::string > &components, const json &entry)
 Insert a register entry into the addressSpace hierarchy, mirroring the module path via "children" objects.
 
size_t padToAlignment (size_t size)
 Round a byte size up to a multiple of 4 (the dummy minimum transfer alignment).
 
int main (int argc, char *argv[])
 

Function Documentation

◆ accessString()

std::string accessString ( const ChimeraTK::BackendRegisterInfoBase &  info)

Return the jmap "access" string for a register from its read/write capability.

Definition at line 273 of file chimeratk-device-to-jmap.cc.

◆ byteSizePerElement()

size_t byteSizePerElement ( const ChimeraTK::DataDescriptor &  descriptor,
size_t  stringLength 
)

Return the number of bytes per single element of the given data descriptor.

The generic Device interface does not expose the byte size of ASCII strings, so the configured fixed –string-length is used for them, only relevant for the synthetic address assignment.

Definition at line 209 of file chimeratk-device-to-jmap.cc.

◆ insertRegister()

void insertRegister ( json &  children,
const std::vector< std::string > &  components,
const json &  entry 
)

Insert a register entry into the addressSpace hierarchy, mirroring the module path via "children" objects.

A path component may be a register (with its own address and data descriptor) and, at the same time, a module carrying further registers below it (cf. the "BSP" and "DAQ" entries in the simpleJsonFile.jmap fixture). In that case the register data and the "children" object coexist in a single entry, so leaf and module nodes are handled uniformly: the destination object is created if absent and extended in place (never rebuilt or copied), and at the leaf the register fields are merged in asserting that no existing key is overwritten.

Definition at line 294 of file chimeratk-device-to-jmap.cc.

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 42 of file chimeratk-device-to-jmap.cc.

◆ makeRepresentation()

json makeRepresentation ( const ChimeraTK::DataDescriptor &  descriptor)

Build the jmap "representation" object from the generic data descriptor.

Definition at line 229 of file chimeratk-device-to-jmap.cc.

◆ padToAlignment()

size_t padToAlignment ( size_t  size)

Round a byte size up to a multiple of 4 (the dummy minimum transfer alignment).

Definition at line 326 of file chimeratk-device-to-jmap.cc.