generate channel_envs

This commit is contained in:
Mario Fink 2021-02-11 13:38:07 +01:00
parent 4b510ea91b
commit 1596ca15b5
5 changed files with 61 additions and 27 deletions

2
.gitignore vendored
View File

@ -18,3 +18,5 @@ cyt/*.cpp
*.o *.o
*.csv *.csv
*.parquet *.parquet
src/*.cpp.cpp

View File

@ -84,7 +84,7 @@ namespace imc
// (consider only first four of any CS block) // (consider only first four of any CS block)
int count = 0; int count = 0;
for ( unsigned long int b = begin_; for ( unsigned long int b = begin_;
b < end_ && (!(thekey_.name_==imc::get_key(true,"CS").name_) || count < 4 ); b++ ) b < end_ && ( ! (thekey_.name_== "CS") || count < 4 ); b++ )
{ {
if ( buffer_->at(b) == imc::ch_sep_ ) if ( buffer_->at(b) == imc::ch_sep_ )
{ {

View File

@ -20,6 +20,24 @@ namespace imc
std::string CDuuid_, CTuuid_, Cbuuid_, CPuuid_, CRuuid_, CSuuid_; std::string CDuuid_, CTuuid_, Cbuuid_, CPuuid_, CRuuid_, CSuuid_;
std::string NTuuid_, NOuuid_; std::string NTuuid_, NOuuid_;
// reset all members
void reset()
{
uuid_.clear();
CBuuid_.clear();
CGuuid_.clear();
CCuuid_.clear();
CNuuid_.clear();
CDuuid_.clear();
CTuuid_.clear();
Cbuuid_.clear();
CPuuid_.clear();
CRuuid_.clear();
CSuuid_.clear();
NTuuid_.clear();
NOuuid_.clear();
}
// get info // get info
std::string get_info(int width = 20) std::string get_info(int width = 20)
{ {

View File

@ -117,6 +117,9 @@ namespace imc
&& ( version == ky.version_ || version == -1 ) ) && ( version == ky.version_ || version == -1 ) )
{ {
mykey = ky; mykey = ky;
// provide first match
return mykey;
} }
} }

View File

@ -198,37 +198,48 @@ namespace imc
// generate channel "environments" // generate channel "environments"
void generate_channel_env() void generate_channel_env()
{ {
// declare single channel environment
imc::channel_env chnenv;
chnenv.reset();
// collect affiliate blocks for every channel WITH CHANNEL and AFFILIATE // collect affiliate blocks for every channel WITH CHANNEL and AFFILIATE
// BLOCK CORRESPONDENCE GOVERNED BY BLOCK ORDER IN BUFFER!! // BLOCK CORRESPONDENCE GOVERNED BY BLOCK ORDER IN BUFFER!!
for ( imc::block blk: rawblocks_ ) for ( imc::block blk: rawblocks_ )
{ {
// declare first channel environment
imc::channel_env chnenv;
// if ( blk.get_key() == imc::keys.at("CB") ) chnenv.CBuuid_ = blk.get_uuid(); if ( blk.get_key().name_ == "CN" ) chnenv.CNuuid_ = blk.get_uuid();
// if ( blk.get_key() == imc::keys.at("CG") ) chnenv.CGuuid_ = blk.get_uuid(); else if ( blk.get_key().name_ == "CD" ) chnenv.CDuuid_ = blk.get_uuid();
// if ( blk.get_key() == imc::keys.at("CC") ) chnenv.CCuuid_ = blk.get_uuid(); else if ( blk.get_key().name_ == "CT" ) chnenv.CTuuid_ = blk.get_uuid();
// if ( blk.get_key() == imc::keys.at("CN") ) chnenv.CNuuid_ = blk.get_uuid(); else if ( blk.get_key().name_ == "Cb" ) chnenv.Cbuuid_ = blk.get_uuid();
// // else if ( blk.get_key().name_ == "CP" ) chnenv.CPuuid_ = blk.get_uuid();
// if ( blk.get_key() == imc::keys.at("CD") ) chnenv.CDuuid_ = blk.get_uuid(); else if ( blk.get_key().name_ == "CR" ) chnenv.CRuuid_ = blk.get_uuid();
// if ( blk.get_key() == imc::keys.at("CT") ) chnenv.CTuuid_ = blk.get_uuid(); else if ( blk.get_key().name_ == "CS" ) chnenv.CSuuid_ = blk.get_uuid();
// if ( blk.get_key() == imc::keys.at("Cb") ) chnenv.Cbuuid_ = blk.get_uuid(); else if ( blk.get_key().name_ == "NT" ) chnenv.NTuuid_ = blk.get_uuid();
// if ( blk.get_key() == imc::keys.at("CP") ) chnenv.CPuuid_ = blk.get_uuid(); else if ( blk.get_key().name_ == "NO" ) chnenv.NOuuid_ = blk.get_uuid();
// if ( blk.get_key() == imc::keys.at("CR") ) chnenv.CRuuid_ = blk.get_uuid();
// if ( blk.get_key() == imc::keys.at("CS") ) chnenv.CSuuid_ = blk.get_uuid(); // check for currently associated channel
// // if ( !chnenv.CNuuid_.empty() )
// if ( blk.get_key() == imc::keys.at("NT") ) chnenv.NTuuid_ = blk.get_uuid(); {
// if ( blk.get_key() == imc::keys.at("NO") ) chnenv.NOuuid_ = blk.get_uuid(); // any component/channel is closed by any of {CS, CC, CG, CB}
// if ( blk.get_key().name_ == "CS" || blk.get_key().name_ == "CC"
// // a component is closed by any of {CS, CC, CG, CB} || blk.get_key().name_ == "CG" || blk.get_key().name_ == "CB" )
// if ( blk.get_key() == imc::keys.at("CS") || blk.get_key() == imc::keys.at("CC") {
// || blk.get_key() == imc::keys.at("CG") || blk.get_key() == imc::keys.at("CB") ) chnenv.uuid_ = chnenv.CNuuid_;
// { channel_envs_.insert(
// chnenv.uuid_ = chnenv.CNuuid_; std::pair<std::string,imc::channel_env>(chnenv.CNuuid_,chnenv)
// channel_envs_.insert( );
// std::pair<std::string,imc::channel_env>(chnenv.CNuuid_,chnenv) std::cout<<chnenv.get_info()<<"\n";
// );
// } // reset channel uuid
chnenv.CNuuid_.clear();
}
}
// in contrast to component closed by CS block the blocks CB, CG, CC
// already belong to NEXT component
if ( blk.get_key().name_ == "CB" ) chnenv.CBuuid_ = blk.get_uuid();
else if ( blk.get_key().name_ == "CG" ) chnenv.CGuuid_ = blk.get_uuid();
else if ( blk.get_key().name_ == "CC" ) chnenv.CCuuid_ = blk.get_uuid();
} }
} }