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

Data support functions. More...

#include "support/datalib.h"
#include <algorithm>
Include dependency graph for datalib.cpp:

Macros

#define S_ISDIR(ST_MODE)   (((ST_MODE) & _S_IFMT) == _S_IFDIR)
 

Functions

void log_write (string node, string agent, double utc, string extra, string type, string record, string location)
 Write log entry - full. 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, int type, double utc, const char *record, string directory)
 Write log entry - fixed location, no extra, integer type and agent. More...
 
void log_move (string oldpath, string newpath, bool compress)
 Move log file - path version. 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...
 
vector< double > data_list_archive_days (string node, string agent)
 Get a list of days in a Node archive. 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...
 
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< 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< string > data_list_nodes ()
 Get list of Nodes, directly. More...
 
int32_t data_list_nodes (vector< string > &nodes)
 Get list of Nodes, indirectly. More...
 
int32_t data_get_nodes (vector< cosmosstruc > &node)
 Get vector of Node structures. 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)
 
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_base_path (string node, string location, string agent, string filename)
 Create data file path. More...
 
string data_base_path (string node, string location, string agent)
 
string data_base_path (string node, string location)
 
string data_base_path (string node)
 
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...
 
FILE * data_open (string path, const char *mode)
 Open file from path. More...
 
int32_t set_cosmosroot (string name, bool create_flag)
 Set Root Directory. More...
 
int32_t set_cosmosroot (bool create_flag)
 Find Root Directory. More...
 
string get_cosmosroot (bool create_flag)
 Return COSMOS Root Directory. More...
 
int32_t get_cosmosroot (string &result, 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...
 
string get_cosmosresources (bool create_flag)
 Return COSMOS Resources Directory. More...
 
int32_t get_cosmosresources (string &result, 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...
 
string get_cosmosnodes (bool create_flag)
 Return COSMOS Nodes Directory. More...
 
int32_t get_cosmosnodes (string &result, bool create_flag)
 Get 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...
 
bool data_isdir (string path)
 
bool data_ischardev (string path)
 
bool data_isfile (string path, off_t size)
 
double data_ctime (string path)
 
off_t data_size (string path)
 
int32_t data_execute (string cmd, string &result, string shell)
 

Variables

static string cosmosroot
 Path to COSMOS root directory. More...
 
static string cosmosnodes =""
 Path to COSMOS Nodes directory. More...
 
static string cosmosresources
 Path to COSMOS Resources directory. More...
 
static string nodedir
 Path to current COSMOS Node directory. More...
 

Detailed Description

Data support functions.

Macro Definition Documentation

#define S_ISDIR (   ST_MODE)    (((ST_MODE) & _S_IFMT) == _S_IFDIR)