Skip to content

Commit

Permalink
new: struct FileSplit
Browse files Browse the repository at this point in the history
  • Loading branch information
h-dh committed Aug 20, 2015
1 parent afd9e22 commit 23cd6fe
Show file tree
Hide file tree
Showing 37 changed files with 1,748 additions and 1,578 deletions.
4 changes: 2 additions & 2 deletions include/annotation.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Annotation : public IObj
bool entry(void){return false;}
bool init(void) ;
void linkObject(IObj *){;}
void setFilename(std::string f){file = hdhC::setFilename(f);}
void setFilename(std::string f){file.setFile(f);}
void setProject(std::string s){project=s;}
void setTablePath(std::string p){ tablePath=p; }

Expand Down Expand Up @@ -160,7 +160,7 @@ class Annotation : public IObj

size_t recErrCountLimit;

struct hdhC::FilenameItems file;
struct hdhC::FileSplit file;

std::string project;
std::string tablePath;
Expand Down
7 changes: 3 additions & 4 deletions include/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ class Base : public IObj
bool isVarname( std::string &);
void makeVariable (NcAPI *, std::string name, int id=-1);

// uses struct hdhC::FilenameItems
void setFilename(std::string);
void setFilePath(std::string p) {filenameItems.path=p;}
// uses struct hdhC::FileSplit
void setFilename(std::string f){file.setFile(f);}

//! Connect a frequency distribution object.
void setFreqDistI(FD_interface *p){ fDI=p; return;}
Expand All @@ -113,7 +112,7 @@ class Base : public IObj
void setVarPropsForOperation( void );
void setVarPropsNoOperation( void );

struct hdhC::FilenameItems filenameItems;
struct hdhC::FileSplit file;

std::string linkObjName;
bool isAllocate;
Expand Down
7 changes: 4 additions & 3 deletions include/cell_statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ class CellStatistics : public IObj
bool entry(void){return false;}
bool init(void) ;
void linkObject(IObj *);
void setFilename(std::string name){;}
void setFilePath(std::string s){;}
void setTablePath(std::string p){ ; }

void setFilename(std::string f){file.setFile(f);}

void initDefaults(void);

struct hdhC::FileSplit file;
};

#endif
17 changes: 8 additions & 9 deletions include/cf.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ class CF : public IObj
bool entry(void);
bool init(void) ;
void linkObject(IObj *);
void setFilename(std::string s);
void setFilePath(std::string p) {filenameItems.path=p;}
void setTablePath(std::string p){ tablePath=p; }

void setFilename(std::string f){file.setFile(f);}
void setTablePath(std::string p){tablePath=p;}

void chap(void);
void chap_reco(void);
Expand Down Expand Up @@ -205,7 +204,7 @@ template <typename T>
bool scanStdNameTable(ReadLine&, Variable&, std::string);
void setCheck(std::string&);
void setFollowRecommendations(bool b){followRecommendations=b;}
void setTable(std::string p){ std_name_table=p; }
// void setTable(std::string p){ std_name_table=p; }
bool timeUnitsFormat(Variable&, bool annot=true);
std::string
units_lon_lat(Variable&, std::string units="");
Expand All @@ -219,14 +218,14 @@ template <typename T>
bool isFeatureType;
std::string cFVersion;

struct hdhC::FilenameItems filenameItems;
std::string tablePath;
struct hdhC::FileSplit file;
struct hdhC::FileSplit std_name_table;
struct hdhC::FileSplit area_table;
struct hdhC::FileSplit region_table;

ut_system* unitSystem;

std::string std_name_table;
std::string area_table;
std::string region_table;
std::string tablePath;

std::string timeName; // the name of the unlimited/time variable
int time_ix;
Expand Down
6 changes: 5 additions & 1 deletion include/cf_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,15 @@ objects. Brief explanation of Base-derived option-strings is given by
--help on the command-line*/
void
parseOptions(int argc, char *org_argv[],
std::vector<std::string> &filename,
InFile &in, CF &cf, Annotation &notes) ;

/*! Called in function parseOptions(); see there.*/
void
readOptions(std::vector<std::string> &argv);

struct hdhC::FileSplit file;

void
setFilename(std::string f){file.setFile(f);}

#endif
7 changes: 4 additions & 3 deletions include/fd_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class FD_interface : public IObj
/*! A previous session might be resumed.*/
bool init(void);
void linkObject(IObj *);
void setFilename(std::string name);
void setFilePath(std::string p) {filenameItems.path=p;}

void setFilename(std::string f){file.setFile(f);}
void setTablePath(std::string p){ ; }

//! Settings by options.
Expand Down Expand Up @@ -102,7 +102,8 @@ class FD_interface : public IObj
{srcStr.push_back(s); return;}

int identNum;
struct hdhC::FilenameItems filenameItems;
struct hdhC::FileSplit file;

std::string vName;
std::vector<std::string> srcStr;

Expand Down
36 changes: 28 additions & 8 deletions include/hdhC.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,30 @@ struct FieldDataMeta
size_t size;
};

struct FilenameItems
struct FileSplit
{
FileSplit() : is(false) {;}
void clear(void);

std::string
getBasename(void){ return basename ; }
std::string
getExtension(void){ return extension ; }
std::string
getFile(void);
std::string
getFilename(void);
std::string
getPath(void){ return path ; }

bool isExisting(std::string f="");
void setExtension(std::string);
void setFile(std::string f );

void setFilename(std::string);
void setPath(std::string f){ path=f; }

bool is;
std::string file;
std::string filename;
std::string basename;
std::string extension;
Expand Down Expand Up @@ -280,9 +300,6 @@ getPathComponents(std::string &str, std::string &path,
std::string &fName, std::string &base,
std::string &ext);

struct FilenameItems
setFilename(std::string&) ;

//! Invert the ordering of bits
/*! For any type of T*/
template <typename T>
Expand Down Expand Up @@ -443,11 +460,14 @@ tf_var(std::string& v, bool colon, bool blank, bool isUpper);
std::string
clearChars(std::string &str, std::string s="", bool isStr=false );

//! replace multiple internal spaces by a single blank
//! replace multiple characters by a single one
std::string
clearInternalMultipleSpaces(std::string &str);

std::string
clearInternalMultipleSpaces(std::string &str );
clearSuccessiveIdenticalCharacters(std::string &str, char );

//! rermove white spaces and newlines
//! remove white spaces and newlines
std::string
clearSpaces(std::string &str );

Expand Down
7 changes: 4 additions & 3 deletions include/in_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class InFile : public Base
bool entry(void);
bool init(void) ;
void linkObject(IObj *);
void setTablePath(std::string p){ ; }

void applyOptions(void);
void applyOptions(std::vector<std::string> &v);
Expand Down Expand Up @@ -119,8 +118,10 @@ class InFile : public Base
void setRecEnd(size_t rec) {ncRecEnd=rec;}

//! Store the path to the netcdf file.
void setFilename(std::string);
void setFilePath(std::string p) {filenameItems.path=p;}
void setFilename(std::string f){file.setFile(f);}
void setTablePath(std::string p){ ; }

struct hdhC::FileSplit file;

bool enableEntry;
bool isInfNan;
Expand Down
3 changes: 0 additions & 3 deletions include/iobj.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ class IObj{
virtual bool entry(void) = 0;
virtual bool init(void) = 0;
virtual void linkObject(IObj *) = 0;
virtual void setFilename(std::string ) = 0 ;
virtual void setFilePath(std::string ) = 0 ;
virtual void setTablePath(std::string ) = 0 ;

//! Pointer to a member function in the polymorph context.
/*! This pointer contains initially the pointer to the
Expand Down
32 changes: 16 additions & 16 deletions include/qa.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ class QA : public IObj
the data of fields.*/
bool init(void) ;
void linkObject(IObj *);
void setFilename(std::string name);
void setFilePath(std::string p) {filenameItems.path=p;}
void setTablePath(std::string p){ tablePath=p; }

// special: frim InFile with path and period stripped.
void setFilename(hdhC::FileSplit&);
void setTablePath(std::string p){tablePath=p;}

void applyOptions(bool isPost=false);

Expand Down Expand Up @@ -285,14 +286,14 @@ class QA : public IObj
std::string
getFrequency(void);

std::string
getStandardTable(void){ return varReqTable ; }
// std::string
// getStandardTable(void){ return varReqTable.file ; }

//! Get the Standard table name from the global attributes
void getSubTable(void);

std::string
getTablePath(void){ return tablePath; }
// std::string
// getTablePath(void){ return tablePath; }

//! Brief description of options
static void
Expand Down Expand Up @@ -398,7 +399,13 @@ class QA : public IObj
bool testPeriodFormat(std::vector<std::string> &sd) ;

//! Name of the netCDF file with results of the quality control
struct hdhC::FilenameItems filenameItems;
std::string tablePath;
struct hdhC::FileSplit qaFile;
struct hdhC::FileSplit archiveDesignTable;
struct hdhC::FileSplit GCM_ModelnameTable;
struct hdhC::FileSplit projectTableFile;
struct hdhC::FileSplit RCM_ModelnameTable;
struct hdhC::FileSplit varReqTable;

std::string qaNcfileFlags;

Expand Down Expand Up @@ -447,15 +454,8 @@ class QA : public IObj
std::vector<std::string> replicationOpts;
std::vector<std::string> requiredAttributesOption;

std::string GCM_ModelNameTable;
std::string RCM_ModelNameTable;
std::string archiveDesignTable;

std::string cfStndNames;
std::string currTable;
std::string projectTableName;
std::string varReqTable;
std::string tablePath;

std::string frequency;
std::string parentExpID;
Expand Down Expand Up @@ -498,7 +498,7 @@ class QA : public IObj
std::string getSubjectsIntroDim(VariableMetaData &vMD,
struct DimensionMetaData &nc_entry,
struct DimensionMetaData &tbl_entry, bool isColon=true);
std::string getVarnameFromFilename(std::string &str);
std::string getVarnameFromFilename(std::string str);
bool not_equal(double x1, double x2, double epsilon);
void pushBackVarMeDa(Variable*);
void setExit(int);
Expand Down
24 changes: 12 additions & 12 deletions include/qa_CMIP5.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ class QA : public IObj
the data of fields.*/
bool init(void) ;
void linkObject(IObj *);
void setFilename(std::string);
void setFilePath(std::string p) {filenameItems.path=p;}
void setTablePath(std::string p){ tablePath=p; }

void setFilename(hdhC::FileSplit&);
void setTablePath(std::string p){tablePath=p;}

void applyOptions(bool isPost=false);

Expand Down Expand Up @@ -318,14 +318,14 @@ class QA : public IObj
std::string
getPath(std::string& f, std::string mode="total");

std::string
getVarReqTable(void){ return varReqTableName ; }
// std::string
// getVarReqTable(void){ return varReqTable.file ; }

std::string
getTablePath(void){ return tablePath; }
// std::string
// getTablePath(void){ return tablePath; }

std::string
getVarnameFromFilename(std::string &str);
getVarnameFromFilename(std::string str);

//! Brief description of options
static void
Expand Down Expand Up @@ -406,7 +406,10 @@ class QA : public IObj
bool testPeriod(void);

//! Name of the netCDF file with results of the quality control
struct hdhC::FilenameItems filenameItems;
std::string tablePath;
struct hdhC::FileSplit qaFile;
struct hdhC::FileSplit projectTableFile;
struct hdhC::FileSplit varReqTable;

std::string qaNcfileFlags;

Expand Down Expand Up @@ -454,9 +457,6 @@ class QA : public IObj

std::string cfStndNames;
std::string currTable;
std::string projectTableName;
std::string varReqTableName;
std::string tablePath;
std::string MIP_tableName;
std::string frequency;
std::string totalPeriod;
Expand Down

0 comments on commit 23cd6fe

Please sign in to comment.