* imc_channel, imc_raw: optimize with pass by reference
* imc_object: asc_time, localtime: make threadsafe * imc_datatype: satisfy 'rule of two' * python: remove all unused imports
This commit is contained in:
parent
72378877ec
commit
83922c343f
@ -147,7 +147,7 @@ namespace imc
|
|||||||
std::string group_uuid_, group_name_, group_comment_;
|
std::string group_uuid_, group_name_, group_comment_;
|
||||||
|
|
||||||
// constructor takes channel's block environment
|
// constructor takes channel's block environment
|
||||||
channel(channel_env chnenv, std::map<std::string,imc::block>* blocks,
|
channel(channel_env &chnenv, std::map<std::string,imc::block>* blocks,
|
||||||
std::vector<unsigned char>* buffer):
|
std::vector<unsigned char>* buffer):
|
||||||
chnenv_(chnenv), blocks_(blocks), buffer_(buffer),
|
chnenv_(chnenv), blocks_(blocks), buffer_(buffer),
|
||||||
factor_(1.), offset_(0.),
|
factor_(1.), offset_(0.),
|
||||||
|
@ -70,6 +70,21 @@ namespace imc
|
|||||||
// identify type
|
// identify type
|
||||||
short int& dtype() { return dtidx_; }
|
short int& dtype() { return dtidx_; }
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
datatype(const datatype &num)
|
||||||
|
{
|
||||||
|
this->ubyte_ = num.ubyte_;
|
||||||
|
this->sbyte_ = num.sbyte_;
|
||||||
|
this->ushort_ = num.ushort_;
|
||||||
|
this->sshort_ = num.sshort_;
|
||||||
|
this->ulint_ = num.ulint_;
|
||||||
|
this->slint_ = num.slint_;
|
||||||
|
this->sfloat_ = num.sfloat_;
|
||||||
|
this->sdouble_ = num.sdouble_;
|
||||||
|
this->sdigital_ = num.sdigital_;
|
||||||
|
this->dtidx_ = num.dtidx_;
|
||||||
|
}
|
||||||
|
|
||||||
// overall assignment operator
|
// overall assignment operator
|
||||||
datatype& operator=(const datatype &num)
|
datatype& operator=(const datatype &num)
|
||||||
{
|
{
|
||||||
|
@ -501,16 +501,16 @@ namespace imc
|
|||||||
second_ = std::stod( get_parameter(buffer,¶meters[7]) );
|
second_ = std::stod( get_parameter(buffer,¶meters[7]) );
|
||||||
|
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
struct tm* ts;
|
struct tm ts;
|
||||||
time(&rawtime);
|
time(&rawtime);
|
||||||
ts = localtime(&rawtime);
|
localtime_r(&rawtime,&ts);
|
||||||
ts->tm_mday = day_;
|
ts.tm_mday = day_;
|
||||||
ts->tm_mon = month_-1;
|
ts.tm_mon = month_-1;
|
||||||
ts->tm_year = year_-1900;
|
ts.tm_year = year_-1900;
|
||||||
ts->tm_hour = hour_;
|
ts.tm_hour = hour_;
|
||||||
ts->tm_min = minute_;
|
ts.tm_min = minute_;
|
||||||
ts->tm_sec = (int)second_;
|
ts.tm_sec = (int)second_;
|
||||||
timestamp_ = asctime(ts);
|
asctime_r(&ts,×tamp_[0]);
|
||||||
// timestamp_ = std::to_string(year_) + std::string("-") + std::to_string(month_)
|
// timestamp_ = std::to_string(year_) + std::string("-") + std::to_string(month_)
|
||||||
// + std::string("-") + std::to_string(day_)
|
// + std::string("-") + std::to_string(day_)
|
||||||
// + std::string("T") + std::to_string(hour_)
|
// + std::string("T") + std::to_string(hour_)
|
||||||
|
@ -300,7 +300,7 @@ namespace imc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// list a particular type of block
|
// list a particular type of block
|
||||||
std::vector<imc::block> list_blocks(imc::key mykey)
|
std::vector<imc::block> list_blocks(const imc::key &mykey)
|
||||||
{
|
{
|
||||||
std::vector<imc::block> myblocks;
|
std::vector<imc::block> myblocks;
|
||||||
for ( imc::block blk: this->rawblocks_ )
|
for ( imc::block blk: this->rawblocks_ )
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#-----------------------------------------------------------------------------#
|
#-----------------------------------------------------------------------------#
|
||||||
|
|
||||||
import glob
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# find source files
|
# find source files
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
from setuptools import setup, Extension
|
from setuptools import setup, Extension
|
||||||
import os
|
|
||||||
|
|
||||||
with open("README.md", "r", encoding="utf-8") as fh:
|
with open("README.md", "r", encoding="utf-8") as fh:
|
||||||
long_description = fh.read()
|
long_description = fh.read()
|
||||||
|
@ -5,7 +5,6 @@ import raw_eater
|
|||||||
import raw_meat
|
import raw_meat
|
||||||
import pyarrow as pa
|
import pyarrow as pa
|
||||||
import pyarrow.parquet as pq
|
import pyarrow.parquet as pq
|
||||||
import glob
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
fileobj1 = Path("smp/Rangerover_Evoque_F-RR534_2019-05-07/").rglob("*.raw")
|
fileobj1 = Path("smp/Rangerover_Evoque_F-RR534_2019-05-07/").rglob("*.raw")
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
|
|
||||||
import imc_termite
|
import imc_termite
|
||||||
import json
|
import json
|
||||||
import glob
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# list files in sample directory
|
# list files in sample directory
|
||||||
# fileobj1 = Path("samples/").rglob("*.raw")
|
# fileobj1 = Path("samples/").rglob("*.raw")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user