Open source Very Long Baseline Interferometry
OpenVLBI
Public Member Functions | List of all members

Inherit this class to create an OpenVLBI server application.

Public Member Functions

 Server (void)
 Constructor, initializes all the internal variables.
 
virtual ~Server (void)
 Destructor, destroys this object.
 
virtual int Init (int argc, char **argv)
 Called immediately after main(), can be overriden to add your custom arguments. More...
 
virtual void Parse (void)
 main() creates a loop that calls Parse(), you can use this one, which uses the standard syntax or override it with your own implementation
 
void addContext (const char *name)
 add a new OpenVLBI context by giving it a name. VLBI::Server has an internal context collection More...
 
void delContext (const char *name)
 delete an existing OpenVLBI context by name. More...
 
void setContext (const char *name)
 set the current OpenVLBI context by passing its name. More...
 
vlbi_context getContext (void)
 Obtain the current OpenVLBI context object. More...
 
char * currentContext (void)
 Obtain the name current OpenVLBI context. More...
 
void addModel (const char *name, char *format, char *b64)
 Create a new model from a picture, give it a name and add it to the current context. More...
 
dsp_stream_p getModel (const char *name)
 Obtain the dsp_stream_p object of a model by passing its name. More...
 
char * getModel (const char *name, char *format)
 Obtain the base64 encoded file buffer of a model by passing its name. More...
 
void delModel (const char *name)
 delete from the current context an existing model by name. More...
 
int getModels (char **names)
 get the names of all the models of the current context. More...
 
void addNode (const char *name, char *b64)
 Create a new node from a monodimensional image FITS file, give it a name and add it to the current context. More...
 
void addNodes (const char *name, char *b64)
 Create as many nodes as the rows number of an SDFITS file, give it a name and add it to the current context. More...
 
void addNode (const char *name, dsp_location *locations, void *buf, int len, timespec starttime, bool geo)
 Create a new node from a its raw data, give it a name and add it to the current context. More...
 
void delNode (const char *name)
 delete from the current context an existing node by name. More...
 
void CopyNode (const char *name, const char *node)
 Copy a node into another node. More...
 
void Plot (const char *name, int flags)
 Plot the current observation into a new model. More...
 
void Idft (const char *name, const char *magnitude, const char *phase)
 Obtain an inverse fourier transform from the magnitude and phase models passed. More...
 
void Dft (const char *name, const char *magnitude, const char *phase)
 Save the magnitude and phase to new models obtained by the fourier transform of the model passed. More...
 
void Mask (const char *name, const char *model, const char *mask)
 Mask a model with another model by multiplication. More...
 
void Stack (const char *name, const char *model1, const char *model2)
 Stack a model with another model. More...
 
void Copy (const char *name, const char *model)
 Copy a model into another model. More...
 
void Diff (const char *name, const char *model1, const char *model2)
 Diff a model with another model. More...
 
void Convolute (const char *name, const char *model1, const char *model2)
 Convolute a model with a convolution matrix model. More...
 
void LowPass (const char *name, const char *node, double freq)
 Apply a low pass filter on a node buffer. More...
 
void HighPass (const char *name, const char *node, double freq)
 Apply a high pass filter on a node buffer. More...
 
void BandPass (const char *name, const char *node, double lofreq, double hifreq)
 Apply a band pass filter on a node buffer. More...
 
void BandReject (const char *name, const char *node, double lofreq, double hifreq)
 Apply a band reject filter on a node buffer. More...
 
void Shift (const char *name)
 Shift a model by its dimension in-place. More...
 
virtual void setRa (double value)
 set the target right ascension coordinate, do this before calling Plot() More...
 
virtual void setDec (double value)
 set the target declination coordinate, do this before calling Plot() More...
 
virtual void setFreq (double value)
 set the frequency observed, do this before calling Plot() More...
 
virtual void setSampleRate (double value)
 set the sampling frequency, do this before calling Plot() More...
 
virtual void setBps (int value)
 set the bytes per sample, do this before calling addNode() More...
 
virtual void setWidth (int value)
 set the plot width, do this before calling Plot() More...
 
virtual void setHeight (int value)
 set the plot height, do this before calling Plot() More...
 
double getRa (void)
 get the current right ascension coordinate More...
 
double getDec (void)
 get the current declination coordinate More...
 
double getFreq (void)
 get the current frequency More...
 
double getSampleRate (void)
 get the current sample rate More...
 
void setCorrelationOrder (int order)
 set the current correlation order More...
 
double getBps (void)
 get the bytes per sample More...
 
double getWidth (void)
 get the plot width More...
 
double getHeight (void)
 get the plot height More...
 
void setInput (FILE *in)
 set the input stream More...
 
FILE * getInput ()
 get the input stream More...
 
void setOutput (FILE *out)
 set the output stream More...
 
FILE * getOutput ()
 get the output stream More...
 
void setDelegate (vlbi_func2_t func)
 set the delegate function More...
 
vlbi_func2_t getDelegate ()
 get the current delegate function More...
 

Member Function Documentation

◆ addContext()

void VLBI::Server::addContext ( const char *  name)
Parameters
nameThe name of the new context

◆ addModel()

void VLBI::Server::addModel ( const char *  name,
char *  format,
char *  b64 
)
Parameters
nameThe name of the new model
formatThe format of the new model, can be one of png, jpeg or fits
b64The file buffer base64 encoded

◆ addNode() [1/2]

void VLBI::Server::addNode ( const char *  name,
char *  b64 
)
Parameters
nameThe name of the new node
b64The file buffer base64 encoded

◆ addNode() [2/2]

void VLBI::Server::addNode ( const char *  name,
dsp_location locations,
void *  buf,
int  len,
timespec  starttime,
bool  geo 
)
Parameters
nameThe name of the new node
locationsA pointer to its location(s), will be pointed from the new node, so don't free() it until the node is deleted
bufThe data buffer of the new node. Will be casted, according the current value of Bps, to the element type with the current word size
lenThe number of elements
starttimeThe UTC time of the first element
geoIf 1, consider all elements of location as geographic coordinates, if 0 as relative to the current context' station location

◆ addNodes()

void VLBI::Server::addNodes ( const char *  name,
char *  b64 
)
Parameters
nameThe name of the new node
b64The file buffer base64 encoded

◆ BandPass()

void VLBI::Server::BandPass ( const char *  name,
const char *  node,
double  lofreq,
double  hifreq 
)
Parameters
nameThe name of the new node
nodeThe name of the unfiltered node
lofreqThe low cut frequency in radians
hifreqThe high cut frequency in radians

◆ BandReject()

void VLBI::Server::BandReject ( const char *  name,
const char *  node,
double  lofreq,
double  hifreq 
)
Parameters
nameThe name of the new node
nodeThe name of the unfiltered node
lofreqThe low cut frequency in radians
hifreqThe high cut frequency in radians

◆ Convolute()

void VLBI::Server::Convolute ( const char *  name,
const char *  model1,
const char *  model2 
)
Parameters
nameThe name of the new model
model1The name of the model
model2The name of the model used as convolution matrix

◆ Copy()

void VLBI::Server::Copy ( const char *  name,
const char *  model 
)
Parameters
nameThe name of the new model
modelThe name of the model to be copied

◆ CopyNode()

void VLBI::Server::CopyNode ( const char *  name,
const char *  node 
)
Parameters
nameThe name of the new node
nodeThe name of the node to be copied

◆ currentContext()

char* VLBI::Server::currentContext ( void  )
inline
Returns
The name of the current context

◆ delContext()

void VLBI::Server::delContext ( const char *  name)
Parameters
nameThe name of the context to be deleted

◆ delModel()

void VLBI::Server::delModel ( const char *  name)
Parameters
nameThe name of the model to be deleted

◆ delNode()

void VLBI::Server::delNode ( const char *  name)
Parameters
nameThe name of the node to be deleted

◆ Dft()

void VLBI::Server::Dft ( const char *  name,
const char *  magnitude,
const char *  phase 
)
Parameters
nameThe name of the model
magnitudeThe name of the new model that will contain the magnitude
phaseThe name of the new model that will contain the phase

◆ Diff()

void VLBI::Server::Diff ( const char *  name,
const char *  model1,
const char *  model2 
)
Parameters
nameThe name of the new model
model1The name of the first model
model2The name of the second model to be subtracted from model1

◆ getBps()

double VLBI::Server::getBps ( void  )
inline
Returns
The word width in bytes

◆ getContext()

vlbi_context VLBI::Server::getContext ( void  )
Returns
The vlbi_context object representing the current context

◆ getDec()

double VLBI::Server::getDec ( void  )
inline
Returns
The current declination in hours

◆ getDelegate()

vlbi_func2_t VLBI::Server::getDelegate ( )
inline
Returns
The current delegate

◆ getFreq()

double VLBI::Server::getFreq ( void  )
inline
Returns
The frequency in Hz

◆ getHeight()

double VLBI::Server::getHeight ( void  )
inline
Returns
The plot height in pixels

◆ getInput()

FILE* VLBI::Server::getInput ( )
inline
Returns
The input stream file pointer

◆ getModel() [1/2]

dsp_stream_p VLBI::Server::getModel ( const char *  name)
Parameters
nameThe name of the model
Returns
The dsp_stream_p object representing the model

◆ getModel() [2/2]

char* VLBI::Server::getModel ( const char *  name,
char *  format 
)
Parameters
nameThe name of the model
formatThe format of the picture exported, can be one of png, jpeg or fits
Returns
The file buffer base64 encoded

◆ getModels()

int VLBI::Server::getModels ( char **  names)
Parameters
namesThe pointer of a char* array to be filled with the names of the models
Returns
The number of models in the current context

◆ getOutput()

FILE* VLBI::Server::getOutput ( )
inline
Returns
The output stream file pointer

◆ getRa()

double VLBI::Server::getRa ( void  )
inline
Returns
The current right ascension in hours

◆ getSampleRate()

double VLBI::Server::getSampleRate ( void  )
inline
Returns
The sampling rate in sps

◆ getWidth()

double VLBI::Server::getWidth ( void  )
inline
Returns
The plot width in pixels

◆ HighPass()

void VLBI::Server::HighPass ( const char *  name,
const char *  node,
double  freq 
)
Parameters
nameThe name of the new node
nodeThe name of the unfiltered node
freqThe cutoff frequency in radians

◆ Idft()

void VLBI::Server::Idft ( const char *  name,
const char *  magnitude,
const char *  phase 
)
Parameters
nameThe name of the new model
magnitudeThe name of the model used as magnitude
phaseThe name of the model used as phase

◆ Init()

virtual int VLBI::Server::Init ( int  argc,
char **  argv 
)
inlinevirtual
Parameters
argcNon-negative value representing the number of arguments passed to the program from the environment in which the program is run.
argvPointer to the first element of an array of argc + 1 pointers, of which the last one is null and the previous ones, if any, point to strings that represent the arguments passed to the program from the host environment.

◆ LowPass()

void VLBI::Server::LowPass ( const char *  name,
const char *  node,
double  freq 
)
Parameters
nameThe name of the new node
nodeThe name of the unfiltered node
freqThe cutoff frequency in radians

◆ Mask()

void VLBI::Server::Mask ( const char *  name,
const char *  model,
const char *  mask 
)
Parameters
nameThe name of the new model
modelThe name of the model to be masked
maskThe name of the mask model

◆ Plot()

void VLBI::Server::Plot ( const char *  name,
int  flags 
)
Parameters
nameThe name of the new model
flagsThe vlbi_plot_flags that characterize this observation

◆ setBps()

virtual void VLBI::Server::setBps ( int  value)
inlinevirtual
Parameters
valueThe word width in bytes

◆ setContext()

void VLBI::Server::setContext ( const char *  name)
Parameters
nameThe name of the context

◆ setCorrelationOrder()

void VLBI::Server::setCorrelationOrder ( int  order)
Parameters
orderThe correlation order

◆ setDec()

virtual void VLBI::Server::setDec ( double  value)
inlinevirtual
Parameters
valueThe Declination coordinate in degrees

◆ setDelegate()

void VLBI::Server::setDelegate ( vlbi_func2_t  func)
inline
Parameters
funcThe new delegate

◆ setFreq()

virtual void VLBI::Server::setFreq ( double  value)
inlinevirtual
Parameters
valueThe frequency in Hz

◆ setHeight()

virtual void VLBI::Server::setHeight ( int  value)
inlinevirtual
Parameters
valueplot height in pixels

◆ setInput()

void VLBI::Server::setInput ( FILE *  in)
inline
Parameters
inThe input stream file pointer

◆ setOutput()

void VLBI::Server::setOutput ( FILE *  out)
inline
Parameters
outThe output stream file pointer

◆ setRa()

virtual void VLBI::Server::setRa ( double  value)
inlinevirtual
Parameters
valueThe RA coordinate in hours

◆ setSampleRate()

virtual void VLBI::Server::setSampleRate ( double  value)
inlinevirtual
Parameters
valueThe sample rate, in samples per second

◆ setWidth()

virtual void VLBI::Server::setWidth ( int  value)
inlinevirtual
Parameters
valueplot width in pixels

◆ Shift()

void VLBI::Server::Shift ( const char *  name)
Parameters
nameThe name of the model

◆ Stack()

void VLBI::Server::Stack ( const char *  name,
const char *  model1,
const char *  model2 
)
Parameters
nameThe name of the new model
model1The name of the first model to be stacked
model2The name of the second model to be stacked