XCube Stream Reader SDK
|
#include <Projects.h>
Public Member Functions | |
Projects (string mntBasePnt="", string projBasePath="", unsigned diskCount=0) | |
Constructor. | |
virtual | ~Projects () |
De-constructor. | |
vector< PROJECT > | pmGetProjects () |
Return a list of project on the active volume. | |
int | pmDeleteProject (string const &prjName) |
Delete a project. | |
int | pmCloseProject () |
int | pmActivateProject (string prjName) |
Mark a project as the active project. | |
int | pmInactivateProject () |
Close an opened project. | |
PROJECT * | pmGetActiveProject () |
Return the active project currently. | |
int | pmGetStreams (vector< STREAM > &streamList) |
Return all streams belonging to the active project. | |
bool | pmIsProjectAlive () const |
Indicate whether a project is created and alive now. | |
bool | pmIsProjectActive () |
Whether a project is opened. | |
PROJECT * | pmGetCurrentProject () |
Return a pointer points to the current project. | |
void | pmSetCurrentProject (string projectName) |
Set current project. | |
string | pmGetRootPath () const |
Return the root path of projects. | |
string | pmGetMntBasePnt () const |
Return the path of the base mount point. | |
unsigned | pmGetDiskCount () const |
Get the number of disks. | |
void | pmSetDiskCount (int numOfDisks) |
Set the number of disks. | |
PROJECT * | pmGetLatestProject () |
Get the latest project. | |
int | pmGetStreamFiles (STREAM const &stream, vector< string > &streamFiles) |
Public Attributes | |
bool | mProjectCreated |
project created flag | |
Protected Member Functions | |
int | pmScanProjects () |
Scan all projects on the active volume. | |
int | pmRemoveDirectory (string path) |
bool | pmIsDirectory (string path) |
Whether path is a regular file or directory. | |
INT64 | pmGetProjectDataSize (string const &projName, vector< int > &missingDisks) |
Return the size of the data file belonging to a project. | |
int | pmScanStreams (PROJECT &proj) |
Scan all streams of a specific project. | |
void | pmParseStreamName (STREAM &stream) |
Parse the name of a stream. | |
PROJECT * | pmFindProject (string prjName) |
search a project based its name | |
unsigned long long | pmGetStreamSize (STREAM const &stream) |
Get stream size. | |
unsigned long long | pmGetStreamSizeDeepSearch (STREAM const &stream) |
unsigned long long | pmGetProjectDataSizeDeepSearch (std::string const &prjName) |
int | pmDeleteProjectDeepSearch (std::string const &prjName) |
Protected Attributes | |
string | mRootPath |
path of the root of projects, | |
string | mMntBasePnt |
path of the base mount point | |
UINT32 | mDiskCount |
number of disks | |
vector< PROJECT > | mProjects |
project list | |
PROJECT * | mActiveProject |
opened project pointer | |
PROJECT * | mCurrentProject |
current project pointer | |
Static Protected Attributes | |
static const int | MntBasePntNo = MNT_POINT_BASE_NUMBER |
base mount point number |
Projects class.
Class of project manager, it provides all functionality to manage projects of the logger.
Projects::Projects | ( | string | mntBasePnt = "" , |
string | projBasePath = "" , |
||
unsigned | diskCount = 0 |
||
) |
Constructor.
Construct an object of project manager
mntBasePnt | path of the base mount point |
projBasePath | path of the base project |
diskCount | number of disks of the active volume |
mntPtNumAfterBase | true if the mount point number should follow the projBasePath rather than the mntBasePnt |
virtual Projects::~Projects | ( | ) | [virtual] |
De-constructor.
De-construct an object of a project manager, clean all fields and memory
int Projects::pmActivateProject | ( | string | prjName | ) |
Mark a project as the active project.
Only one project may be active at any time.
prjName | - name of the project to set active |
int Projects::pmCloseProject | ( | ) |
Close the current project.
int Projects::pmDeleteProject | ( | string const & | prjName | ) |
Delete a project.
Delete a project, including all sub directories and data streams, across all disks.
prjName | - name of the project to delete |
int Projects::pmDeleteProjectDeepSearch | ( | std::string const & | prjName | ) | [protected] |
Delete a project. The search for the project directories is done starting from the mount point
prjName | A string representing the project name |
PROJECT* Projects::pmFindProject | ( | string | prjName | ) | [protected] |
search a project based its name
Look for a project in the project list for a project matches the name. Project name is unique.
prjName | - name of the project to search |
Return the active project currently.
Search is there any project opened, if yes, return a pointer to the opened project, or return NULL
Return a pointer points to the current project.
Return the last project descriptor int the project list which is the latest project.
projectName | - name of current project |
unsigned Projects::pmGetDiskCount | ( | ) | const |
Get the number of disks.
Return the number of disks detected by the system as usable
Get the latest project.
Return the latest created project
string Projects::pmGetMntBasePnt | ( | ) | const |
Return the path of the base mount point.
For example. "/mnt/disk"
INT64 Projects::pmGetProjectDataSize | ( | string const & | projName, |
vector< int > & | missingDisks | ||
) | [protected] |
Return the size of the data file belonging to a project.
Get the total size of a project(Go through all disks and sum up the size of data ), report any missing disks
projName | name of a project |
missingDisks | list of missing disks |
unsigned long long Projects::pmGetProjectDataSizeDeepSearch | ( | std::string const & | prjName | ) | [protected] |
Return total data size of all of the streams in a project. A search for the project is done starting from the mount point. Then each project directory is searched for stream files.
stream | - the stream to get size |
vector<PROJECT> Projects::pmGetProjects | ( | ) |
Return a list of project on the active volume.
First do a projects scan, find out all projects, then return all projects found on the active volume as a project list
string Projects::pmGetRootPath | ( | ) | const |
Return the root path of projects.
Get the root path of projects, for example "/xcube"
int Projects::pmGetStreamFiles | ( | STREAM const & | stream, |
vector< string > & | streamFiles | ||
) |
Return a collection of stream files for a given STREAM
stream | The Stream to search for files | |
[out] | streamFiles | a reference to a vector where the stream filenames will be stored. |
int Projects::pmGetStreams | ( | vector< STREAM > & | streamList | ) |
Return all streams belonging to the active project.
Search all streams belonging to the opened project and return them
streamList | - streams belong to the opened project (will be written in) |
unsigned long long Projects::pmGetStreamSize | ( | STREAM const & | stream | ) | [protected] |
Get stream size.
Return total data size of a stream, sum up all data files on all disks
stream | - the stream to get size |
unsigned long long Projects::pmGetStreamSizeDeepSearch | ( | STREAM const & | stream | ) | [protected] |
Return total data size of a stream, sum up all data files on all disks A search for all stream files is done starting from the mount point
stream | - the stream to get size |
int Projects::pmInactivateProject | ( | ) |
Close an opened project.
Close an opened project, if no project opened, return error code
bool Projects::pmIsDirectory | ( | string | path | ) | [protected] |
Whether path is a regular file or directory.
Boolean function to check whether path is a regular file or directory
path | - the path to test |
bool Projects::pmIsProjectActive | ( | ) |
Whether a project is opened.
Tell whether there is any project opened there
bool Projects::pmIsProjectAlive | ( | ) | const |
Indicate whether a project is created and alive now.
Boolean function to check whether there is a project created and alive in the system
void Projects::pmParseStreamName | ( | STREAM & | stream | ) | [protected] |
Parse the name of a stream.
Parse the name of stream into stream enum, stream type and stream run
stream | - the stream to parse |
int Projects::pmRemoveDirectory | ( | string | path | ) | [protected] |
Remove a directory indicated by path, this function is designed for "pmDeleteProject" to delete the project directory on the disks
path | - path of the directory to remove |
int Projects::pmScanProjects | ( | ) | [protected] |
Scan all projects on the active volume.
Scan all projects created on the active volumes, it will search "/mnt/disk0" for all projects.
int Projects::pmScanStreams | ( | PROJECT & | proj | ) | [protected] |
Scan all streams of a specific project.
Scan all streams of a specific project and fill in the stream list information
proj | - the project to be scaned |
void Projects::pmSetCurrentProject | ( | string | projectName | ) |
Set current project.
projectName | - name of current project |
void Projects::pmSetDiskCount | ( | int | numOfDisks | ) |
Set the number of disks.
Set the number of disks
PROJECT* Projects::mActiveProject [protected] |
opened project pointer
points to the opened project if any, or NULL if there is no project opened
UINT32 Projects::mDiskCount [protected] |
number of disks
total number of disks of the active volumes
string Projects::mMntBasePnt [protected] |
path of the base mount point
for example, "/mnt/disk"
const int Projects::MntBasePntNo = MNT_POINT_BASE_NUMBER [static, protected] |
base mount point number
is initialize to MNT_POINT_BASE_NUMBER, which is 0
project created flag
when a project is created, it will be marked as true, when the project is done, will be marked back as false
vector<PROJECT> Projects::mProjects [protected] |
project list
A vector containing all projects belong to the active volumes
string Projects::mRootPath [protected] |
path of the root of projects,
for example: "/xcube" completes the path "/mnt/disk#/xcube"