Page History
...
Code Block |
---|
fs::path path = m_path; std::cout << "stem = " << path.stem().string() << "\n"; // e158-r0150-s00-c00 std::cout << "extension() = " << path.extension().string() << "\n"; // .xtc std::cout << "filename() = " << path.filename().string() << "\n"; // e158-r0150-s00-c00.xtc std::cout << "parent_path() = " << path.parent_path().string() << "\n"; // /reg/d/psdm/CXI/cxi49012/xtc |
Singleton
InputParameters.h
Code Block |
---|
#include <iostream>
class InputParameters {
public:
static InputParameters* Instance();
void print();
private:
InputParameters () ; // Private so that it can not be called from outside
virtual ~InputParameters () {};
static InputParameters* m_pInstance; // Singleton instance
// Copy constructor and assignment are disabled by default
InputParameters ( const InputParameters& ) ;
InputParameters& operator = ( const InputParameters& ) ;
};
|
InputParameters.cc
Code Block |
---|
#include "<Package>/InputParameters.h"
InputParameters* InputParameters::m_pInstance = NULL;
//----------------
InputParameters::InputParameters ()
{
std::cout << "!!!!!!!! Single instance for singleton class InputParameters is created \n";
}
//----------------
//----------------
InputParameters* InputParameters::Instance()
{
if( !m_pInstance ) m_pInstance = new InputParameters();
return m_pInstance;
}
//----------------
void InputParameters::print()
{
std::cout << "InputParameters::print()\n";
}
|
Overview
Content Tools