1#if !defined(_PIODATA_H)
16 bool operator()(
const char* p,
const char* q)
const {
return strcmp(p, q) < 0; };
43typedef std::multimap<const char*, PIO_FIELD*, Cstring_less>
VAR_MAP;
44typedef VAR_MAP::iterator
VMI;
45typedef VAR_MAP::const_iterator
CVMI;
46typedef std::pair<VMI, VMI>
VMP;
47typedef std::pair<CVMI, CVMI>
CVMP;
52 PIO_DATA(
const char* piofile = 0,
const std::list<std::string>* fields_to_read = 0,
53 bool _defer_read_data =
true,
const std::set<const char*, Cstring_less>* rdata = 0,
54 const std::set<const char*, Cstring_less>* cdata = 0);
64 inline bool good_read() {
return (pio_field != 0) ? true :
false; }
81 void GetPIOData(
const char*,
const double*&,
const char*&);
88 if (RealData.find(_name) == RealData.end())
89 RealData.insert(strdup(_name));
93 if (CharData.find(_name) == CharData.end())
94 CharData.insert(strdup(_name));
100 std::set<const char*, Cstring_less> RealData;
101 std::set<const char*, Cstring_less> CharData;
103 std::istream* Infile;
107 int PIO_HEADER_LENGTH;
108 int PIO_INDEX_LENGTH;
109 const char* pio_dandt;
111 int64_t pio_position;
114 bool defer_read_data;
116 size_t timertype_len;
120 void ReadPioFieldData(
PIO_FIELD& pio_field);
121 bool read(
const char*,
const std::list<std::string>* fields_to_read = 0);
122 bool read(
const std::list<std::string>* fields_to_read = 0);
123 inline void byte_flip(
char* word, int64_t size)
125 if (size_buf < (
size_t)size)
130 buf =
new char[size_buf];
132 memcpy((
void*)buf, (
const void*)word, size);
133 for (int64_t i = 0; i < size; ++i)
134 word[i] = buf[size - 1 - i];
138 inline T read_pio_word(T& val)
141 this->Infile->read((
char*)&word,
sizeof(word));
143 byte_flip((
char*)&word,
sizeof(word));
148 inline bool read_pio_bool()
151 this->Infile->read((
char*)&word,
sizeof(word));
153 byte_flip((
char*)&word,
sizeof(word));
154 return (word != 0) ? true :
false;
157 inline void fstr2Cstr(
char* s,
size_t len)
const
168 inline char* read_pio_char_string(
size_t len)
175 buf =
new char[size_buf];
177 this->Infile->read(buf, len);
180 char* val =
new char[strlen(buf) + 1];
185 inline void insert_VAR_MAP_pairs()
187 for (
int i = 0; i < pio_num; ++i)
189 if (pio_field[i].read_field_data)
191#if !defined __SUNPRO_CC
192 VarMMap.insert(std::make_pair(pio_field[i].pio_name, pio_field + i));
194 VAR_MAP::value_type
type(pio_field[i].pio_name, pio_field + i);
201 inline bool read_field(
const char* pio_name,
const std::list<std::string>* fields_to_read)
203 std::string spio_name = std::string(pio_name);
204 if (fields_to_read == 0)
208 for (std::list<std::string>::const_iterator pos = fields_to_read->begin();
209 pos != fields_to_read->end(); ++pos)
211 if (spio_name == *pos)
bool IsPIOfile(const char *)
bool GetPIOfileTime(const char *, double &)
std::pair< VMI, VMI > VMP
std::pair< CVMI, CVMI > CVMP
std::multimap< const char *, PIO_FIELD *, Cstring_less > VAR_MAP
VAR_MAP::const_iterator CVMI
PIO_DATA(const char *piofile=0, const std::list< std::string > *fields_to_read=0, bool _defer_read_data=true, const std::set< const char *, Cstring_less > *rdata=0, const std::set< const char *, Cstring_less > *cdata=0)
void print(std::ostream &)
void AddCharData(const char *_name)
int get_pio_signature() const
void GetPIOData(PIO_FIELD &, const double *&)
int get_PIO_INDEX_LENGTH() const
void GetPIOData(PIO_FIELD &, const double *&, const char *&)
void AddRealData(const char *_name)
void GetPIOData(const char *, const double *&)
PIO_FIELD * get_pio_field() const
bool GetPIOfileTime(const char *, double &)
void GetPIOData(const char *, const char *&)
double GetPIOData(const char *, int)
const double * GetPIOData(PIO_FIELD &)
const char * get_name() const
void GetPIOData(PIO_FIELD &, const char *&)
void FreePIOData(PIO_FIELD &pio_field)
bool set_vector_field(std::valarray< std::valarray< double > > &, const char *)
bool set_scalar_field(std::valarray< double > &, const char *)
bool get_reverse_endian() const
int get_pio_num_with_size(int64_t n) const
int get_PIO_HEADER_LENGTH() const
int get_PIO_NAME_LENGTH() const
void GetPIOData(const char *, const double *&, const char *&)
bool set_scalar_field(std::valarray< uint64_t > &, const char *)
bool set_scalar_field(std::valarray< int64_t > &, const char *)
const double * GetPIOData(const char *)
bool set_scalar_field(std::valarray< int > &, const char *)
const char * get_pio_dandt() const
int get_PIO_VERSION() const
bool operator()(const char *p, const char *q) const