Compare commits
No commits in common. "cf2799b3839b5f0cd5b13d5cb456737f9b454449" and "53fea5f738fa00c881013f1927625660cc838a43" have entirely different histories.
cf2799b383
...
53fea5f738
@ -14,7 +14,6 @@ typedef unsigned short int eUInt16Usi;
|
|||||||
typedef unsigned int eUInt32Usi;
|
typedef unsigned int eUInt32Usi;
|
||||||
typedef float eFloat32Usi;
|
typedef float eFloat32Usi;
|
||||||
typedef double eFloat64Usi;
|
typedef double eFloat64Usi;
|
||||||
typedef char eStringUsi;
|
|
||||||
|
|
||||||
class tdmdatatype
|
class tdmdatatype
|
||||||
{
|
{
|
||||||
@ -27,13 +26,12 @@ protected:
|
|||||||
eUInt32Usi uint32_; // 4
|
eUInt32Usi uint32_; // 4
|
||||||
eFloat32Usi float32_; // 5
|
eFloat32Usi float32_; // 5
|
||||||
eFloat64Usi float64_; // 6
|
eFloat64Usi float64_; // 6
|
||||||
eStringUsi string_; // 7
|
short int dtidx_; // \in \{0,...,6\}
|
||||||
short int dtidx_; // \in \{0,...,7\}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
tdmdatatype(): sint16_(0), sint32_(0),
|
tdmdatatype(): sint16_(0), sint32_(0),
|
||||||
uint8_(0), uint16_(0), uint32_(0),
|
uint8_(0), uint16_(0), uint32_(0),
|
||||||
float32_(0.0), float64_(0.0), string_(0),
|
float32_(0.0), float64_(0.0),
|
||||||
dtidx_(0) { };
|
dtidx_(0) { };
|
||||||
// every supported datatype gets its own constructor
|
// every supported datatype gets its own constructor
|
||||||
tdmdatatype(eInt16Usi num): sint16_(num), dtidx_(0) {};
|
tdmdatatype(eInt16Usi num): sint16_(num), dtidx_(0) {};
|
||||||
@ -43,7 +41,6 @@ public:
|
|||||||
tdmdatatype(eUInt32Usi num): uint32_(num), dtidx_(4) {};
|
tdmdatatype(eUInt32Usi num): uint32_(num), dtidx_(4) {};
|
||||||
tdmdatatype(eFloat32Usi num): float32_(num), dtidx_(5) {};
|
tdmdatatype(eFloat32Usi num): float32_(num), dtidx_(5) {};
|
||||||
tdmdatatype(eFloat64Usi num): float64_(num), dtidx_(6) {};
|
tdmdatatype(eFloat64Usi num): float64_(num), dtidx_(6) {};
|
||||||
tdmdatatype(eStringUsi num): string_(num), dtidx_(7) {};
|
|
||||||
|
|
||||||
// identify type
|
// identify type
|
||||||
short int& dtype() { return dtidx_; }
|
short int& dtype() { return dtidx_; }
|
||||||
@ -58,7 +55,6 @@ public:
|
|||||||
this->uint32_ = num.uint32_;
|
this->uint32_ = num.uint32_;
|
||||||
this->float32_ = num.float32_;
|
this->float32_ = num.float32_;
|
||||||
this->float64_ = num.float64_;
|
this->float64_ = num.float64_;
|
||||||
this->string_ = num.string_;
|
|
||||||
this->dtidx_ = num.dtidx_;
|
this->dtidx_ = num.dtidx_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +70,6 @@ public:
|
|||||||
this->uint32_ = num.uint32_;
|
this->uint32_ = num.uint32_;
|
||||||
this->float32_ = num.float32_;
|
this->float32_ = num.float32_;
|
||||||
this->float64_ = num.float64_;
|
this->float64_ = num.float64_;
|
||||||
this->string_ = num.string_;
|
|
||||||
this->dtidx_ = num.dtidx_;
|
this->dtidx_ = num.dtidx_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,12 +119,6 @@ public:
|
|||||||
this->dtidx_ = 6;
|
this->dtidx_ = 6;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
tdmdatatype& operator=(const eStringUsi &num)
|
|
||||||
{
|
|
||||||
this->string_ = num;
|
|
||||||
this->dtidx_ = 7;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// obtain number as double
|
// obtain number as double
|
||||||
double as_double()
|
double as_double()
|
||||||
@ -142,7 +131,6 @@ public:
|
|||||||
else if ( dtidx_ == 4 ) num = (double)uint32_;
|
else if ( dtidx_ == 4 ) num = (double)uint32_;
|
||||||
else if ( dtidx_ == 5 ) num = (double)float32_;
|
else if ( dtidx_ == 5 ) num = (double)float32_;
|
||||||
else if ( dtidx_ == 6 ) num = (double)float64_;
|
else if ( dtidx_ == 6 ) num = (double)float64_;
|
||||||
else if ( dtidx_ == 7 ) num = (double)(int)string_;
|
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +144,6 @@ public:
|
|||||||
else if ( num.dtidx_ == 4 ) out<<num.uint32_;
|
else if ( num.dtidx_ == 4 ) out<<num.uint32_;
|
||||||
else if ( num.dtidx_ == 5 ) out<<num.float32_;
|
else if ( num.dtidx_ == 5 ) out<<num.float32_;
|
||||||
else if ( num.dtidx_ == 6 ) out<<num.float64_;
|
else if ( num.dtidx_ == 6 ) out<<num.float64_;
|
||||||
else if ( num.dtidx_ == 7 ) out<<num.string_;
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,7 +332,7 @@ const std::vector<tdm_datatype> tdm_datatypes = {
|
|||||||
{"eFloat32Usi","DT_FLOAT",3,"float_sequence",4,"32 bit float"},
|
{"eFloat32Usi","DT_FLOAT",3,"float_sequence",4,"32 bit float"},
|
||||||
{"eFloat64Usi","DT_DOUBLE",7,"double_sequence",8,"64 bit double"},
|
{"eFloat64Usi","DT_DOUBLE",7,"double_sequence",8,"64 bit double"},
|
||||||
|
|
||||||
{"eStringUsi","DT_STRING",1,"string_sequence",1,"text"}
|
// {"eStringUsi","DT_STRING",1,"string_sequence",0,"text"}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -445,14 +445,9 @@ void tdm_termite::process_localcolumns(bool showlog, pugi::xml_document& xml_doc
|
|||||||
{
|
{
|
||||||
locc.values_ = vl.at(0);
|
locc.values_ = vl.at(0);
|
||||||
}
|
}
|
||||||
else if ( vl.size() == 0 )
|
|
||||||
{
|
|
||||||
//std::cerr<<"localcolumn ("<<locc.id_<<","<<locc.name_<<") misses any value-ids"<<"\n";
|
|
||||||
locc.values_ = "none";
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw std::logic_error("localcolumn with multiple values id(s)");
|
throw std::logic_error("localcolumn with out/multiple values id(s)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// add external id referring to block in <usi:include>
|
// add external id referring to block in <usi:include>
|
||||||
@ -465,7 +460,7 @@ void tdm_termite::process_localcolumns(bool showlog, pugi::xml_document& xml_doc
|
|||||||
{
|
{
|
||||||
throw std::runtime_error(std::string("measurement_quantity: ")
|
throw std::runtime_error(std::string("measurement_quantity: ")
|
||||||
+ locc.measurement_quantity_
|
+ locc.measurement_quantity_
|
||||||
+ std::string(" is missing/ambiguous") );
|
+ std::string(" is ambiguous") );
|
||||||
}
|
}
|
||||||
std::string dt = tdmchannels_.at(locc.measurement_quantity_).datatype_;
|
std::string dt = tdmchannels_.at(locc.measurement_quantity_).datatype_;
|
||||||
std::string sequence_type;
|
std::string sequence_type;
|
||||||
@ -487,10 +482,8 @@ void tdm_termite::process_localcolumns(bool showlog, pugi::xml_document& xml_doc
|
|||||||
|
|
||||||
if ( locc.external_id_.empty() )
|
if ( locc.external_id_.empty() )
|
||||||
{
|
{
|
||||||
//throw std::logic_error( std::string("no external id found for ")
|
throw std::logic_error( std::string("no external id found for ")
|
||||||
// + sequence_type + std::string(" with ") + locc.values_ );
|
+ sequence_type + std::string(" with ") + locc.values_ );
|
||||||
//std::cerr<<"no external id found for "<<sequence_type<<" with "<<locc.values_<<"\n";
|
|
||||||
locc.external_id_ = "none";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,8 +508,8 @@ std::string tdm_termite::get_channel_overview(format chformatter)
|
|||||||
|
|
||||||
// compose header
|
// compose header
|
||||||
chformatter.set_header(true);
|
chformatter.set_header(true);
|
||||||
//tdm_channelgroup grp;
|
tdm_channelgroup grp;
|
||||||
//channels_summary += grp.get_info(chformatter);
|
channels_summary += grp.get_info(chformatter);
|
||||||
tdm_channel chn;
|
tdm_channel chn;
|
||||||
channels_summary += chn.get_info(chformatter);
|
channels_summary += chn.get_info(chformatter);
|
||||||
std::string rule; // = std::string("#");
|
std::string rule; // = std::string("#");
|
||||||
@ -533,9 +526,8 @@ std::string tdm_termite::get_channel_overview(format chformatter)
|
|||||||
it!=tdmchannels_.end(); ++it)
|
it!=tdmchannels_.end(); ++it)
|
||||||
{
|
{
|
||||||
// get corresponding group
|
// get corresponding group
|
||||||
// tdm_channelgroup grp = tdmchannelgroups_.at(it->second.group_);
|
tdm_channelgroup grp = tdmchannelgroups_.at(it->second.group_);
|
||||||
// channels_summary += grp.get_info(chformatter);
|
channels_summary += grp.get_info(chformatter);
|
||||||
|
|
||||||
// ...and actual channel
|
// ...and actual channel
|
||||||
channels_summary += it->second.get_info(chformatter);
|
channels_summary += it->second.get_info(chformatter);
|
||||||
channels_summary += std::string("\n");
|
channels_summary += std::string("\n");
|
||||||
@ -627,7 +619,7 @@ std::vector<tdmdatatype> tdm_termite::get_channel(std::string& id)
|
|||||||
// retrieve full channel info
|
// retrieve full channel info
|
||||||
tdm_channel chn = tdmchannels_.at(id);
|
tdm_channel chn = tdmchannels_.at(id);
|
||||||
|
|
||||||
// extract (first) "localcolumn" for channel TODO there should only be a single!! local_column!!
|
// extract (first) "localcolumn" for channel
|
||||||
if ( chn.local_columns_.size() != 1 )
|
if ( chn.local_columns_.size() != 1 )
|
||||||
{
|
{
|
||||||
throw std::runtime_error(std::string("invalid local_columns_ of channel: ") + id);
|
throw std::runtime_error(std::string("invalid local_columns_ of channel: ") + id);
|
||||||
@ -644,28 +636,8 @@ std::vector<tdmdatatype> tdm_termite::get_channel(std::string& id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// use "values" id to map to external block
|
// use "values" id to map to external block
|
||||||
if ( loccol.external_id_ == "none" )
|
|
||||||
{
|
|
||||||
//throw std::runtime_error(std::string("missing external_id in local_column ")+loccol.id_);
|
|
||||||
//std::cerr<<"missing external_id in local_column "<<loccol.id_<<"\n";
|
|
||||||
return std::vector<tdmdatatype>(0);
|
|
||||||
}
|
|
||||||
block blk = tdx_blocks_.at(loccol.external_id_);
|
block blk = tdx_blocks_.at(loccol.external_id_);
|
||||||
|
|
||||||
// find corresponding submatrix
|
|
||||||
if ( submatrices_.count(loccol.submatrix_) != 1 )
|
|
||||||
{
|
|
||||||
throw std::runtime_error(std::string("no associated submatrix for localcolumn found: ") + loccol.id_);
|
|
||||||
}
|
|
||||||
submatrix subm = submatrices_.at(loccol.submatrix_);
|
|
||||||
if ( subm.number_of_rows_ != blk.length_ )
|
|
||||||
{
|
|
||||||
std::stringstream ss;
|
|
||||||
ss<<"number of rows in submatrix "<<subm.id_<<" ("<<subm.number_of_rows_<<") "
|
|
||||||
<<" does not agree with length of associated block "<<blk.id_<<" ("<<blk.length_<<")";
|
|
||||||
throw std::runtime_error(ss.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// declare vector of appropriate length
|
// declare vector of appropriate length
|
||||||
std::vector<tdmdatatype> datavec(blk.length_);
|
std::vector<tdmdatatype> datavec(blk.length_);
|
||||||
|
|
||||||
@ -719,10 +691,6 @@ std::vector<tdmdatatype> tdm_termite::get_channel(std::string& id)
|
|||||||
{
|
{
|
||||||
this->convert_data_to_type<eFloat64Usi>(tdxblk,datavec);
|
this->convert_data_to_type<eFloat64Usi>(tdxblk,datavec);
|
||||||
}
|
}
|
||||||
else if ( blk.value_type_ == std::string("eStringUsi") )
|
|
||||||
{
|
|
||||||
this->convert_data_to_type<eStringUsi>(tdxblk,datavec);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw std::runtime_error(std::string("unsupported/unknown datatype") + blk.value_type_);
|
throw std::runtime_error(std::string("unsupported/unknown datatype") + blk.value_type_);
|
||||||
@ -1019,10 +987,6 @@ void tdm_termite::check_datatype_consistency()
|
|||||||
{
|
{
|
||||||
if ( el.size_ != sizeof(eFloat64Usi) ) throw std::logic_error("invalid representation of eFloat64Usi");
|
if ( el.size_ != sizeof(eFloat64Usi) ) throw std::logic_error("invalid representation of eFloat64Usi");
|
||||||
}
|
}
|
||||||
else if ( el.name_ == "eStringUsi" )
|
|
||||||
{
|
|
||||||
if ( el.size_ != sizeof(eStringUsi) ) throw std::logic_error("invalid representation of eStringUsi");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw std::logic_error("missing datatype validation");
|
throw std::logic_error("missing datatype validation");
|
||||||
|
9
makefile
9
makefile
@ -23,11 +23,8 @@ LIB := $(foreach dir,$(shell ls $(LIBB)),-I $(LIBB)$(dir))
|
|||||||
GTAG := $(shell git tag | tail -n1)
|
GTAG := $(shell git tag | tail -n1)
|
||||||
GTAGV := $(shell git tag | tail -n1 | tr -d 'v')
|
GTAGV := $(shell git tag | tail -n1 | tr -d 'v')
|
||||||
GHSH := $(shell git rev-parse HEAD | head -c8)
|
GHSH := $(shell git rev-parse HEAD | head -c8)
|
||||||
PIPYVS := $(shell grep "version" pip/setup.py | tr -d 'version=,\#\" ')
|
PIPYVS := $(shell grep "version" pip/setup.py | tr -d 'version=",# ')
|
||||||
PICGVS := $(shell grep "version" pip/setup.cfg | tr -d 'version=,\#\" ')
|
PICGVS := $(shell grep "version" pip/setup.cfg | tr -d 'version=",# ')
|
||||||
|
|
||||||
# current timestamp
|
|
||||||
TMS = $(shell date +%Y%m%dT%H%M%S)
|
|
||||||
|
|
||||||
# define install location
|
# define install location
|
||||||
INST := /usr/local/bin
|
INST := /usr/local/bin
|
||||||
@ -66,12 +63,10 @@ main.o : src/main.cpp lib/$(SRC).hpp $(HPP)
|
|||||||
@if [ $(OST) = "Linux" ]; then\
|
@if [ $(OST) = "Linux" ]; then\
|
||||||
sed -i 's/TAGSTRING/$(GTAG)/g' $<.cpp; \
|
sed -i 's/TAGSTRING/$(GTAG)/g' $<.cpp; \
|
||||||
sed -i 's/HASHSTRING/$(GHSH)/g' $<.cpp; \
|
sed -i 's/HASHSTRING/$(GHSH)/g' $<.cpp; \
|
||||||
sed -i 's/TIMESTAMPSTRING/$(TMS)/g' $<.cpp; \
|
|
||||||
fi
|
fi
|
||||||
@if [ $(OST) = "Darwin" ]; then\
|
@if [ $(OST) = "Darwin" ]; then\
|
||||||
sed -i '' 's/TAGSTRING/$(GTAG)/g' $<.cpp; \
|
sed -i '' 's/TAGSTRING/$(GTAG)/g' $<.cpp; \
|
||||||
sed -i '' 's/HASHSTRING/$(GHSH)/g' $<.cpp; \
|
sed -i '' 's/HASHSTRING/$(GHSH)/g' $<.cpp; \
|
||||||
sed -i '' 's/TIMESTAMPSTRING/$(TMS)/g' $<.cpp; \
|
|
||||||
fi
|
fi
|
||||||
$(CC) -c $(OPT) $(LIB) -I lib/ $<.cpp -o $@
|
$(CC) -c $(OPT) $(LIB) -I lib/ $<.cpp -o $@
|
||||||
@rm $<.cpp
|
@rm $<.cpp
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = TDMtermite-RecordEvolution
|
name = TDMtermite-RecordEvolution
|
||||||
version = 1.0.5
|
version = 1.0.1
|
||||||
author = Record Evolution GmbH
|
author = Record Evolution GmbH
|
||||||
author_email = mario.fink@record-evolution.de
|
author_email = mario.fink@record-evolution.de
|
||||||
maintainer = Record Evolution GmbH
|
maintainer = Record Evolution GmbH
|
||||||
|
@ -18,7 +18,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="TDMtermite",
|
name="TDMtermite",
|
||||||
version="1.0.5",
|
version="1.0.3",
|
||||||
author="Record Evolution GmbH",
|
author="Record Evolution GmbH",
|
||||||
author_email="mario.fink@record-evolution.de",
|
author_email="mario.fink@record-evolution.de",
|
||||||
maintainer="Record Evolution GmbH",
|
maintainer="Record Evolution GmbH",
|
||||||
|
11
src/main.cpp
11
src/main.cpp
@ -11,12 +11,11 @@
|
|||||||
|
|
||||||
const std::string gittag("TAGSTRING");
|
const std::string gittag("TAGSTRING");
|
||||||
const std::string githash("HASHSTRING");
|
const std::string githash("HASHSTRING");
|
||||||
const std::string timestamp("TIMESTAMPSTRING");
|
|
||||||
|
|
||||||
void show_usage()
|
void show_usage()
|
||||||
{
|
{
|
||||||
std::cout<<"\n"
|
std::cout<<"\n"
|
||||||
<<"tdmtermite ["<<gittag<<"-g"<<githash<<"-"<<timestamp<<"] (https://github.com/RecordEvolution/TDMtermite.git)"
|
<<"tdmtermite ["<<gittag<<"-g"<<githash<<"] (github.com/RecordEvolution/TDMtermite.git)"
|
||||||
<<"\n\n"
|
<<"\n\n"
|
||||||
<<"Decode TDM/TDX files and dump data as *.csv"
|
<<"Decode TDM/TDX files and dump data as *.csv"
|
||||||
<<"\n\n"
|
<<"\n\n"
|
||||||
@ -79,7 +78,7 @@ optkeys parse_args(int argc, char* argv[], bool showargs = false)
|
|||||||
else if ( std::string(argv[1]) == std::string("--version")
|
else if ( std::string(argv[1]) == std::string("--version")
|
||||||
|| std::string(argv[1]) == std::string("-v") )
|
|| std::string(argv[1]) == std::string("-v") )
|
||||||
{
|
{
|
||||||
std::cout<<"tdmtermite "<<gittag<<"-g"<<githash<<"-"<<timestamp<<"\n";
|
std::cout<<"tdmtermite "<<gittag<<"-g"<<githash<<"\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -285,13 +284,13 @@ int main(int argc, char* argv[])
|
|||||||
if ( showroot ) std::cout<<"\n"<<jack.get_root().get_info()<<"\n";
|
if ( showroot ) std::cout<<"\n"<<jack.get_root().get_info()<<"\n";
|
||||||
|
|
||||||
// get complete channel(-group) overview
|
// get complete channel(-group) overview
|
||||||
format grpformatter(16,false,false,' ');
|
format grpformatter(26,false,false,' ');
|
||||||
if (listgroups) std::cout<<"\n"<<jack.get_overview<tdm_channelgroup>(grpformatter)<<"\n";
|
if (listgroups) std::cout<<"\n"<<jack.get_overview<tdm_channelgroup>(grpformatter)<<"\n";
|
||||||
format chformatter(16,false,false,' ');
|
format chformatter(14,false,false,' ');
|
||||||
if (listchannels) std::cout<<"\n"<<jack.get_channel_overview(chformatter)<<"\n";
|
if (listchannels) std::cout<<"\n"<<jack.get_channel_overview(chformatter)<<"\n";
|
||||||
|
|
||||||
// get complete submatrix/localcolumns overview
|
// get complete submatrix/localcolumns overview
|
||||||
format formatter(16,false,false,' ');
|
format formatter(18,false,false,' ');
|
||||||
if (listblocks) std::cout<<jack.get_overview<block>(formatter)<<"\n";
|
if (listblocks) std::cout<<jack.get_overview<block>(formatter)<<"\n";
|
||||||
if (listsubmatrices) std::cout<<jack.get_overview<submatrix>(formatter)<<"\n";
|
if (listsubmatrices) std::cout<<jack.get_overview<submatrix>(formatter)<<"\n";
|
||||||
if (listlocalcolumns) std::cout<<jack.get_overview<localcolumn>(formatter)<<"\n";
|
if (listlocalcolumns) std::cout<<jack.get_overview<localcolumn>(formatter)<<"\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user