本文整理汇总了C++中FileManager::GetFilename方法的典型用法代码示例。如果您正苦于以下问题:C++ FileManager::GetFilename方法的具体用法?C++ FileManager::GetFilename怎么用?C++ FileManager::GetFilename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::GetFilename方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetLogPath
//------------------------------------------------------------------------------
void ConsoleMessageReceiver::SetLogPath(const std::string &pathname,
bool append)
{
FileManager *fm = FileManager::Instance();
std::string fname;
try
{
std::string filename = fm->GetFilename(FileManager::LOG_FILE);
fname = pathname + filename;
}
catch (BaseException &e)
{
ShowMessage
("**** ERROR **** " + e.GetFullMessage() +
"So setting log file name to GmatLog.txt");
fname = "GmatLog.txt";
}
OpenLogFile(fname, append);
}
示例2: Initialize
//------------------------------------------------------------------------------
bool ITRFAxes::Initialize()
{
#ifdef DEBUG_ITRFAXES_INITIALIZE
MessageInterface::ShowMessage("Initialize ITRFAxes: with name '%s'\n",
instanceName.c_str());
#endif
DynamicAxes::Initialize();
if (originName == SolarSystem::EARTH_NAME) InitializeFK5();
#ifdef DEBUG_FIRST_CALL
firstCallFired = false;
#endif
// create and initialize IAU2000/2006 object:
if (iauFile == NULL)
iauFile = IAUFile::Instance();
iauFile->Initialize();
// create and initialize EopFile object:
if (eop == NULL)
{
FileManager* fm = FileManager::Instance();
std::string name = fm->GetFilename("EOP_FILE");
EopFile* eopFile = new EopFile(name);
eopFile->Initialize();
SetEopFile(eopFile);
}
isInitialized = true;
#ifdef DEBUG_ITRFAXES_INITIALIZE
MessageInterface::ShowMessage("End initialize ITRFAxes: with name '%s'\n",
instanceName.c_str());
#endif
return true;
}
示例3: Initialize
//------------------------------------------------------------------------------
void IAUFile::Initialize()
{
if (isInitialized)
return;
// Allocate buffer to store IAU2000/2006 data:
AllocateArrays();
// Use FileManager::FindPath() for new file path implementation (LOJ: 2014.07.01)
// Open IAU2000/2006 data file:
// FileManager* fm = FileManager::Instance();
// std::string path = fm->GetPathname(FileManager::IAUSOFA_FILE);
// std::string name = fm->GetFilename(FileManager::IAUSOFA_FILE);
// iauFileName = path+name;
// FILE* fpt = fopen(iauFileName.c_str(), "r");
FileManager *fm = FileManager::Instance();
iauFileName = fm->GetFilename(FileManager::IAUSOFA_FILE);
iauFileNameFullPath = fm->FindPath(iauFileName, FileManager::IAUSOFA_FILE, true, true, true);
// Check full path file
if (iauFileNameFullPath == "")
throw GmatBaseException("The IAU file '" + iauFileName + "' does not exist\n");
FILE* fpt = fopen(iauFileNameFullPath.c_str(), "r");
if (fpt == NULL)
throw GmatBaseException("Error: GMAT cann't open '" + iauFileName + "' file!!!\n");
// Read IAU2000/2006 data from data file and store to buffer:
Real t;
Real XYs[3];
int c;
Integer i;
for (i= 0; (c = fscanf(fpt, "%lf %lf %lf %lf\n",&t,&XYs[0],&XYs[1],&XYs[2])) != EOF; ++i)
{
// expend the buffer size when it has no room to contain data:
if (i >= tableSz)
{
// create a new buffer with a larger size:
Integer new_size = tableSz*2;
Real* ind = new Real[new_size];
Real** dep = new Real*[new_size];
// copy contain in the current buffer to the new buffer:
memcpy(ind, independence, tableSz*sizeof(Real));
memcpy(dep, dependences, tableSz*sizeof(Real*));
for (Integer k=tableSz; k < new_size; ++k)
dep[k] = NULL;
// delete the current buffer and use the new buffer as the current buffer:
delete independence;
delete dependences;
independence = ind;
dependences = dep;
tableSz = new_size;
}
// store data to buffer:
independence[i] = t;
if (dependences[i] == NULL)
dependences[i] = new Real[dimension];
for (Integer j = 0; j < dimension; ++j)
dependences[i][j] = XYs[j];
}
fclose(fpt);
pointsCount = i; // why "this->"?
}