37#include <sys/syscall.h>
39#include <SoDa/Format.hxx>
40#include <SoDa/MailBox.hxx>
78 typedef SoDa::MailBox<CommandPtr>
CmdMBox;
114 Base(
const std::string & oname);
187 reason = std::string(_reason);
207 message = SoDa::Format(
"SoDa Object [%0] threw exception [%1]\n")
213 message = SoDa::Format(
"Unknown SoDa Object threw exception [%0]\n")
248 template<
typename BaseT>
class Buf {
282 if(index <
buf.size()) {
286 throw SDR::Exception(SoDa::Format(
"Buffer index %0 is out of range (>= %1)")
287 .addI(index).addI(
buf.size()).str());
311 class CBuf :
public Buf<std::complex<float>> {
BasePtr getSelfPtr()
get a pointer to myself.
Base(const std::string &oname)
The constructor – pass a name for the object.
std::weak_ptr< Base > self
static double base_first_time
time of first call to getTime from anyone.
std::string & getObjName()
get the name of this object
static bool first_time
have we seen the first call to getTime?
void registerSelf(BasePtr ptr)
static std::map< std::string, BasePtr > object_directory
a class member – directory of all registered objects.
BasePtr findSoDaObject(const std::string &oname)
find a SoDa Object by name.
double getTime()
Get a time stamp in nS resolution that monotonically increases and that is very inexpensive (typicall...
std::string objname
the name of the object
BaseT & operator[](size_t index)
Buf(unsigned int size)
constructor: Allocate a complex/real buffer of complex data values
bool setSize(size_t size)
set the length of the buffer (in number of complex floats.)
bool copy(const std::shared_ptr< Buf< BaseT > > &src)
std::vector< BaseT > & getBuf()
Buf specialized buffer for floats only.
static CBufPtr make(unsigned int _size)
Buf specialized buffer for floats only.
static FBufPtr make(unsigned int _size)
The SoDa::SDR Exception class (to distinguish it from the SoDaLibrary SoDa::Exception class.
Exception(const SoDa::Format &_reason, BasePtr obj)
The constructor.
Exception(const std::string &_reason, BasePtr obj=NULL)
The constructor.
const std::string & toString()
Create a string that explains this exception.
const char * what()
Create a string that explains this exception.
BasePtr thrower
who caused the exception, if anyone?
std::string reason
what was the cause of the exception?
Exception(const char *_reason, BasePtr obj)
The constructor.
std::string message
the reason together with the owner.
std::shared_ptr< FBuf > FBufPtr
RXTX
We often need to distinguis between the RX and TX device.
std::shared_ptr< CmdMBox > CmdMBoxPtr
std::shared_ptr< CDatMBox > CDatMBoxPtr
std::shared_ptr< CBuf > CBufPtr
std::shared_ptr< FDatMBox > FDatMBoxPtr
SoDa::MailBox< CommandPtr > CmdMBox
Mailboxes that carry commands only are of type CmdMBox.
std::shared_ptr< Base > BasePtr
SoDa::MailBox< CBufPtr > CDatMBox
Mailboxes that carry float or complex data are of type DatMBox.
SoDa::MailBox< FBufPtr > FDatMBox
Mailboxes that carry float or complex data are of type DatMBox.