Disaggregate
Disaggregate Smart Meter data

Utils Namespace Reference

Functions

const int roundToNearestInt (const double input)
const size_t roundToNearestSizeT (const double input)
const char * todaysDateAndTime ()
const std::string size_t_to_s (size_t num)
void openFile (std::fstream &fs, const std::string &filename, const std::fstream::openmode openmode)
const size_t countDataPoints (std::fstream &fs)
 Find the number of numeric data points in file.
const bool fileExists (const std::string &filename)
const bool roughlyEqual (const double a, const double b, const double tolerance)
 Compares 2 doubles. Are they within (a * tolerance) of each other?
const double & highest (const double &a, const double &b)
const double & lowest (const double &a, const double &b)
const size_tlargest (const size_t &a, const size_t &b)
const size_tsmallest (const size_t &a, const size_t &b)
const bool within (const double a, const double b, const double diff)
const bool between (const double bound1, const double bound2, const double sample)
const std::string secondsToTime (const size_t seconds)
const bool sameSign (const double &a, const double &b)
 Returns true if a and b are the same sign. Zero is assumed to be positive.
void fatalError (const std::string &message)

Function Documentation

const bool Utils::between ( const double  bound1,
const double  bound2,
const double  sample 
)
Returns:
true if sample is between bound1 and bound2.

Definition at line 185 of file Utils.cpp.

Referenced by AggregateData::findSpike(), AggregateData::findTime(), and within().

Here is the caller graph for this function:

const size_t Utils::countDataPoints ( std::fstream &  fs)

Find the number of numeric data points in file.

Returns:
number of data points.

Definition at line 74 of file Utils.cpp.

Referenced by AggregateData::loadCurrentCostData(), and Array< Sample_t >::loadData().

Here is the caller graph for this function:

void Utils::fatalError ( const std::string &  message)

Definition at line 229 of file Utils.cpp.

Referenced by PowerStateGraph::disaggregate(), Array< Sample_t >::dumpToFile(), AggregateData::findTime(), AggregateData::loadCurrentCostData(), Device::loadSignatures(), main(), openFile(), and Array< Sample_t >::setSize().

Here is the caller graph for this function:

const bool Utils::fileExists ( const std::string &  filename)
Returns:
true if 'filename' exists

Definition at line 98 of file Utils.cpp.

Referenced by AggregateData::loadCurrentCostData(), Device::loadSignatures(), and GNUplot::plot().

Here is the caller graph for this function:

const double & Utils::highest ( const double &  a,
const double &  b 
)
Returns:
the larger of the two values

Definition at line 119 of file Utils.cpp.

Referenced by PowerStateGraph::mostSimilarVertex(), and PowerStateGraph::rejectSpike().

Here is the caller graph for this function:

const size_t & Utils::largest ( const size_t a,
const size_t b 
)
Returns:
the larger of the two values

Definition at line 144 of file Utils.cpp.

const double & Utils::lowest ( const double &  a,
const double &  b 
)

Definition at line 130 of file Utils.cpp.

void Utils::openFile ( std::fstream &  fs,
const std::string &  filename,
const std::fstream::openmode  openmode 
)

Definition at line 55 of file Utils.cpp.

References fatalError().

Referenced by PowerStateGraph::displayAndPlotFingerprintList(), PowerStateSequence::dumpToFile(), AggregateData::loadCurrentCostData(), Signature::Signature(), Device::trainPowerStateGraph(), and Signature::updatePowerStates().

Here is the call graph for this function:

Here is the caller graph for this function:

const bool Utils::roughlyEqual ( const double  a,
const double  b,
const double  tolerance 
)

Compares 2 doubles. Are they within (a * tolerance) of each other?

Parameters:
toleranceusually a fraction between 0 and 1.

Definition at line 107 of file Utils.cpp.

Referenced by Signature::getDeltaSpikes().

Here is the caller graph for this function:

const int Utils::roundToNearestInt ( const double  input)

Definition at line 15 of file Utils.cpp.

Referenced by Signature::getPowerState(), Histogram::Histogram(), and Statistic< Sample_t >::Statistic().

Here is the caller graph for this function:

const size_t Utils::roundToNearestSizeT ( const double  input)

Definition at line 20 of file Utils.cpp.

const bool Utils::sameSign ( const double &  a,
const double &  b 
)

Returns true if a and b are the same sign. Zero is assumed to be positive.

Definition at line 221 of file Utils.cpp.

Referenced by AggregateData::findSpike(), and PowerStateGraph::updateOrInsertEdge().

Here is the caller graph for this function:

const std::string Utils::secondsToTime ( const size_t  seconds)

Definition at line 206 of file Utils.cpp.

References size_t_to_s().

Here is the call graph for this function:

const std::string Utils::size_t_to_s ( size_t  num)

Definition at line 42 of file Utils.cpp.

Referenced by PowerStateGraph::displayAndPlotFingerprintList(), Signature::drawHistWithStateBars(), Histogram::getBaseFilename(), Array< Sample_t >::getBaseFilename(), Array< Sample_t >::getSmoothedGradOfHistFilename(), and secondsToTime().

Here is the caller graph for this function:

const size_t & Utils::smallest ( const size_t a,
const size_t b 
)

Definition at line 155 of file Utils.cpp.

const char * Utils::todaysDateAndTime ( )
Returns:
statically allocated time and date formated like "Tue Feb 1 21:39:46 2001 \n\0". For more details, see p188 of The Linux Programming Interface

Definition at line 36 of file Utils.cpp.

Referenced by PowerStateSequence::dumpToFile().

Here is the caller graph for this function:

const bool Utils::within ( const double  a,
const double  b,
const double  diff 
)
Returns:
true if a and and within diff of each other.

Definition at line 171 of file Utils.cpp.

References between().

Referenced by PowerStateGraph::mostSimilarVertex(), PowerStateGraph::rejectSpike(), and PowerStateGraph::updateOrInsertEdge().

Here is the call graph for this function:

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Friends