3Depict
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Functions | Variables
basics.cpp File Reference
#include "common/basics.h"
#include "common/constants.h"
#include "common/stringFuncs.h"
#include "common/translation.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <cstring>
#include <clocale>
Include dependency graph for basics.cpp:

Functions

unsigned int getBitNum (unsigned int u)
 
std::string boolStrEnc (bool b)
 
void pushLocale (const char *newLocale, int type)
 
void popLocale ()
 
bool dummyCallback (bool)
 
void setDefaultFontFile (const std::string &font)
 Return the default font file to use. Must precede (first) call to getDefaultFontFile. More...
 
std::string getDefaultFontFile ()
 Return the default font file to use. More...
 
void tickSpacingsFromInterspace (float start, float end, float interSpacing, std::vector< float > &spacings)
 Convert a normal string to a latex one, using character replacement. More...
 
void tickSpacingsFromFixedNum (float start, float end, unsigned int nTicks, std::vector< float > &spacings)
 
string veryFuzzyTimeSince (time_t origTime, time_t nowTime)
 Get a "human-like" version of the time elapsed between new and original time period. More...
 
std::ostream & operator<< (std::ostream &stream, const BoundCube &b)
 
bool getFilesize (const char *fname, size_t &size)
 Get total filesize in bytes. More...
 
int getTotalRAM ()
 get total ram in MB More...
 
size_t getAvailRAM ()
 Get available ram in MB. More...
 
bool strhas (const char *cpTest, const char *cpPossible)
 
unsigned int loadTextData (const char *cpFilename, vector< vector< float > > &dataVec, vector< string > &headerVec, const char *delim)
 A routine for loading numeric data from a text file. Returns 0 on success. More...
 
unsigned int loadTextStringData (const char *cpFilename, vector< vector< string > > &dataVec, const char *delim)
 Load non-numeric data from a text file into ragged array, using specified delimiters. More...
 
bool isNotDirectory (const char *filename)
 Determine if a given path is a not a directory,. More...
 
bool rmFile (const std::string &filename)
 

Variables

std::string defaultFontFile
 

Function Documentation

◆ boolStrEnc()

std::string boolStrEnc ( bool  b)

◆ dummyCallback()

bool dummyCallback ( bool  )

◆ getAvailRAM()

size_t getAvailRAM ( )

Get available ram in MB.

Referenced by FilterTree::refreshFilterTree(), and UniqueIDHandler::size().

Here is the caller graph for this function:

◆ getBitNum()

unsigned int getBitNum ( unsigned int  u)

References ASSERT.

Referenced by FilterTree::contains(), stream_cast(), and Filter::updateOutputInfo().

Here is the caller graph for this function:

◆ getDefaultFontFile()

std::string getDefaultFontFile ( )

Return the default font file to use.

References defaultFontFile.

Referenced by DrawColourBarOverlay::DrawColourBarOverlay(), DrawPointLegendOverlay::DrawPointLegendOverlay(), BoundingBoxFilter::numBytesForCache(), AnnotateFilter::refresh(), and writeTextFile().

Here is the caller graph for this function:

◆ getFilesize()

bool getFilesize ( const char *  fname,
size_t &  size 
)

◆ getTotalRAM()

int getTotalRAM ( )

get total ram in MB

Referenced by UniqueIDHandler::size().

Here is the caller graph for this function:

◆ isNotDirectory()

bool isNotDirectory ( const char *  filename)

Determine if a given path is a not a directory,.

Referenced by RangeFile::detectFileType(), loadTextData(), loadTextStringData(), DataLoadFilter::setProperty(), and UniqueIDHandler::size().

Here is the caller graph for this function:

◆ loadTextData()

unsigned int loadTextData ( const char *  cpFilename,
vector< vector< float > > &  dataVec,
vector< string > &  headerVec,
const char *  delim 
)

A routine for loading numeric data from a text file. Returns 0 on success.

References ERR_FILE_FORMAT, ERR_FILE_NUM_FIELDS, ERR_FILE_OPEN, isNotDirectory(), splitStrsRef(), stream_cast(), strhas(), and stripZeroEntries().

Referenced by hasFirstInPairVec(), limitLoadTextFile(), ExternalProgramFilter::refresh(), and DataLoadFilter::refresh().

Here is the caller graph for this function:

◆ loadTextStringData()

unsigned int loadTextStringData ( const char *  cpFilename,
vector< vector< string > > &  dataVec,
const char *  delim 
)

Load non-numeric data from a text file into ragged array, using specified delimiters.

References ERR_FILE_FORMAT, ERR_FILE_OPEN, isNotDirectory(), splitStrsRef(), and stripZeroEntries().

Referenced by StringKeyFrameDialog::getStrings(), and hasFirstInPairVec().

Here is the caller graph for this function:

◆ operator<<()

std::ostream& operator<< ( std::ostream &  stream,
const BoundCube b 
)

Referenced by BoundCube::volume().

Here is the caller graph for this function:

◆ popLocale()

void popLocale ( )

Referenced by RangeFile::open(), and MathGLPane::saveSVG().

Here is the caller graph for this function:

◆ pushLocale()

void pushLocale ( const char *  newLocale,
int  type 
)

References ASSERT.

Referenced by RangeFile::open(), and MathGLPane::saveSVG().

Here is the caller graph for this function:

◆ rmFile()

bool rmFile ( const std::string &  filename)

◆ setDefaultFontFile()

void setDefaultFontFile ( const std::string &  font)

Return the default font file to use. Must precede (first) call to getDefaultFontFile.

References defaultFontFile.

Referenced by threeDepictApp::OnInit(), and writeTextFile().

Here is the caller graph for this function:

◆ strhas()

bool strhas ( const char *  cpTest,
const char *  cpPossible 
)

Referenced by loadTextData().

Here is the caller graph for this function:

◆ tickSpacingsFromFixedNum()

void tickSpacingsFromFixedNum ( float  start,
float  end,
unsigned int  nTicks,
std::vector< float > &  spacings 
)

References ASSERT.

Referenced by hasFirstInPairVec(), and AnnotateFilter::refresh().

Here is the caller graph for this function:

◆ tickSpacingsFromInterspace()

void tickSpacingsFromInterspace ( float  start,
float  end,
float  interSpacing,
std::vector< float > &  spacings 
)

Convert a normal string to a latex one, using character replacement.

References ASSERT.

Referenced by hasFirstInPairVec(), and AnnotateFilter::refresh().

Here is the caller graph for this function:

◆ veryFuzzyTimeSince()

string veryFuzzyTimeSince ( time_t  origTime,
time_t  nowTime 
)

Get a "human-like" version of the time elapsed between new and original time period.

References ASSERT, COMPILE_ASSERT, NTRANS, THREEDEP_ARRAYSIZE, and TRANS.

Referenced by MainWindowFrame::checkReloadAutosave(), and hasFirstInPairVec().

Here is the caller graph for this function:

Variable Documentation

◆ defaultFontFile

std::string defaultFontFile