COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
datalib.h File Reference

Data Management header file. More...

#include "support/configCosmos.h"
#include "support/cosmos-errno.h"
#include "support/jsondef.h"
#include "support/jsonlib.h"
#include "thirdparty/zlib/zlib.h"
#include "support/timelib.h"
#include <sys/stat.h>
#include <fstream>
#include <dirent.h>
Include dependency graph for datalib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  filestruc
 

Macros

#define DATA_LOG_TYPE_SOH   0
 
#define DATA_LOG_TYPE_EVENT   1
 
#define DATA_LOG_TYPE_BEACON   2
 
#define DATA_LOG_TYPE_PROGRAM   3
 

Functions

void log_reopen ()
 
void log_write (string node, int type, double utc, const char *record, string directory)
 Write log entry - fixed location, no extra, integer type and agent. More...
 
void log_write (string node, string agent, double utc, string type, const char *record)
 Write log entry - fixed location. More...
 
void log_write (string node, string agent, double utc, string extra, string type, string record, string location)
 Write log entry - full. More...
 
void log_move (string node, string agent, string srclocation, string dstlocation, bool compress)
 Move log file - full version. More...
 
void log_move (string node, string agent)
 Move log file - short version. More...
 
void log_move (string oldpath, string newpath, bool compress)
 Move log file - path version. More...
 
string log_read (gzFile &file, int num)
 log_reads Loop until the newline character is seen. Append it to a string and return the line once the newline is met. More...
 
int check_events (eventstruc *events, int max, cosmosstruc *data)
 
int32_t data_get_nodes (vector< cosmosstruc > &node)
 Get vector of Node structures. More...
 
vector< string > data_list_nodes ()
 Get list of Nodes, directly. More...
 
int32_t data_list_nodes (vector< string > &nodes)
 Get list of Nodes, indirectly. More...
 
vector< filestrucdata_list_files (string directory)
 Get list of files in a directory, directly. More...
 
size_t data_list_files (string directory, vector< filestruc > &files)
 Get list of files in a directory, indirectly. More...
 
vector< filestrucdata_list_files (string node, string location, string agent)
 Get list of files in a Node, directly. More...
 
size_t data_list_files (string node, string location, string agent, vector< filestruc > &files)
 Get list of files in a Node, indirectly. More...
 
vector< filestrucdata_list_archive (string node, string agent, double utc, string type)
 Get a list of files in a Node archive. More...
 
vector< filestrucdata_list_archive (string node, string agent, double utc)
 
vector< double > data_list_archive_days (string node, string agent)
 Get a list of days in a Node archive. More...
 
FILE * data_open (string path, const char *mode)
 Open file from path. More...
 
int32_t data_name_date (string node, string filename, uint16_t &year, uint16_t &jday, uint32_t &seconds)
 Get date from file name. More...
 
int32_t data_name_date (string node, string filename, double &utc)
 Get date from file name. More...
 
string data_name (string node, double mjd, string extra, string type)
 Create data file name. More...
 
string data_name (string node, double mjd, string type)
 
string data_base_path (string node)
 
string data_base_path (string node, string location)
 
string data_base_path (string node, string location, string agent)
 
string data_base_path (string node, string location, string agent, string filename)
 Create data file path. More...
 
string data_archive_path (string node, string agent, double mjd)
 
string data_type_path (string node, string location, string agent, double mjd, string type)
 Create data file path. More...
 
string data_type_path (string node, string location, string agent, double mjd, string extra, string type)
 Create data file path. More...
 
string data_name_path (string node, string location, string agent, double mjd, string name)
 Create data file path. More...
 
string data_resource_path (string name)
 Create resource file path. More...
 
bool data_exists (string &path)
 Check existence of path. More...
 
bool data_isdir (string path)
 
bool data_ischardev (string path)
 
bool data_isfile (string path, off_t size)
 
double data_ctime (string path)
 
int32_t data_execute (string cmd, string &result, string shell)
 
off_t data_size (string path)
 
int32_t set_cosmosroot (string name, bool create_flag)
 Set Root Directory. More...
 
int32_t set_cosmosroot (bool create_flag)
 Find Root Directory. More...
 
int32_t get_cosmosroot (string &result, bool create_flag)
 Return COSMOS Root Directory. More...
 
string get_cosmosroot (bool create_flag)
 Return COSMOS Root Directory. More...
 
int32_t set_cosmosresources (string name, bool create_flag)
 Set Resources Directory. More...
 
int32_t set_cosmosresources (bool create_flag)
 Find Resources Directory. More...
 
int32_t get_cosmosresources (string &result, bool create_flag)
 Return COSMOS Resources Directory. More...
 
string get_cosmosresources (bool create_flag)
 Return COSMOS Resources Directory. More...
 
int32_t setEnvCosmosResources (string path)
 Set Environment Variable for COSMOS resources. More...
 
int32_t setEnvCosmosNodes (string path)
 Set Environment Variable for COSMOS nodes. More...
 
int32_t setEnv (string var, string path)
 Set Environment Variable for COSMOS. More...
 
int32_t setEnvCosmos (string path)
 
int32_t set_cosmosnodes (string name, bool create_flag)
 Set Nodes Directory. More...
 
int32_t set_cosmosnodes (bool create_flag)
 Find COSMOS Nodes Directory on Windows, Linux or MacOS. More...
 
int32_t get_cosmosnodes (string &result, bool create_flag)
 Get COSMOS Nodes Directory. More...
 
string get_cosmosnodes (bool create_flag)
 Return COSMOS Nodes Directory. More...
 
string get_nodedir (string node, bool create_flag)
 Get Current Node Directory. More...
 
int32_t data_load_archive (string node, string agent, double utcbegin, double utcend, string type, vector< string > &result)
 Load data from archive. More...
 
int32_t data_load_archive (string node, string agent, double mjd, string type, vector< string > &result)
 
int32_t data_load_archive (double mjd, vector< string > &telem, vector< string > &event, cosmosstruc *cinfo)
 
double findlastday (string name)
 Find last day in archive. More...
 
double findfirstday (string name)
 Find first day in archive. More...
 
int32_t kml_write (cosmosstruc *cinfo)
 Add to KML path. More...
 

Detailed Description

Data Management header file.