prepare imc_channel + imc_raw for cython interface
This commit is contained in:
parent
40a922893d
commit
3d9305a1be
@ -88,6 +88,9 @@ namespace imc
|
|||||||
template<typename dt>
|
template<typename dt>
|
||||||
std::string joinvec(std::vector<dt> myvec, unsigned long int limit = 10)
|
std::string joinvec(std::vector<dt> myvec, unsigned long int limit = 10)
|
||||||
{
|
{
|
||||||
|
// include entire list for limit = - 1
|
||||||
|
limit = (limit == 0) ? myvec.size() : limit;
|
||||||
|
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss<<"[";
|
ss<<"[";
|
||||||
if ( myvec.size() <= limit )
|
if ( myvec.size() <= limit )
|
||||||
@ -341,7 +344,7 @@ namespace imc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// provide JSON string of metadata
|
// provide JSON string of metadata
|
||||||
std::string get_json()
|
std::string get_json(bool include_data = false)
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss<<"{"<<"\"uuid\":\""<<uuid_
|
ss<<"{"<<"\"uuid\":\""<<uuid_
|
||||||
@ -358,11 +361,15 @@ namespace imc
|
|||||||
<<"\",\"xoffset\":\""<<xoffset_
|
<<"\",\"xoffset\":\""<<xoffset_
|
||||||
<<"\",\"group\":{"<<"\"index\":\""<<group_index_
|
<<"\",\"group\":{"<<"\"index\":\""<<group_index_
|
||||||
<<"\",\"name\":\""<<group_name_
|
<<"\",\"name\":\""<<group_name_
|
||||||
<<"\",\"comment\":\""<<group_comment_<<"\""<<"}"
|
<<"\",\"comment\":\""<<group_comment_<<"\""<<"}";
|
||||||
<<"\",\"ydata\":\""<<imc::joinvec<imc::datatype>(ydata_)
|
if ( include_data )
|
||||||
<<"\",\"xdata\":\""<<imc::joinvec<double>(xdata_)
|
{
|
||||||
<<"\",\"aff. blocks\":\""<<chnenv_.get_json()
|
ss<<"\",\"ydata\":\""<<imc::joinvec<imc::datatype>(ydata_,0)
|
||||||
<<"\"}";
|
<<"\",\"xdata\":\""<<imc::joinvec<double>(xdata_,0);
|
||||||
|
}
|
||||||
|
// ss<<"\",\"aff. blocks\":\""<<chnenv_.get_json()
|
||||||
|
ss<<"\"}";
|
||||||
|
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,13 +267,20 @@ namespace imc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get list of channels with metadata
|
// get list of channels with metadata
|
||||||
std::vector<std::string> get_channels()
|
std::vector<std::string> get_channels(bool json = false, bool include_data = false)
|
||||||
{
|
{
|
||||||
std::vector<std::string> chns;
|
std::vector<std::string> chns;
|
||||||
for ( std::map<std::string,imc::channel>::iterator it = channels_.begin();
|
for ( std::map<std::string,imc::channel>::iterator it = channels_.begin();
|
||||||
it != channels_.end(); ++it)
|
it != channels_.end(); ++it)
|
||||||
{
|
{
|
||||||
chns.push_back(it->second.get_info());
|
if ( !json )
|
||||||
|
{
|
||||||
|
chns.push_back(it->second.get_info());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
chns.push_back(it->second.get_json(include_data));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return chns;
|
return chns;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user