My Project
Public Member Functions | Protected Member Functions | Protected Attributes
ReadNeXusFile Class Reference

Read NeXus binary file. More...

#include <ReadNeXusFile.hh>

List of all members.

Public Member Functions

 ReadNeXusFile (const string &FileName)
 ReadNeXusFile (NXhandle w_handle)
NXhandle PutHandle ()
vector< string > GetGroupInfo ()
vector< string > GetNextEntry ()
vector< Int4 > GetInfo ()
Int4 PutCurrentNumber ()
void OpenGroup (const string &GroupName, const string &GroupClass)
void CloseGroup ()
void OpenData (const string &DataSetName)
void CloseData ()
void ReadData (const string &Name, UInt4 &i)
void ReadData (const string &Name, Int4 &i)
void ReadData (const string &Name, Double &d)
void ReadData (const string &Name, string &s)
void ReadData (const string &Name, vector< UInt4 > &vi)
void ReadData (const string &Name, vector< Int4 > &vi)
void ReadData (const string &Name, vector< Double > &vd)
void ReadData (const string &Name, vector< string > &vs)
UInt4 ReadDataUInt4 (const string &Name)
Int4 ReadDataInt4 (const string &Name)
Double ReadDataDouble (const string &Name)
string ReadDataString (const string &Name)
vector< Double > ReadDoubleVector (const string &Name)
vector< Int4 > ReadInt4Vector (const string &Name)
vector< UInt4 > ReadUInt4Vector (const string &Name)
vector< string > ReadStringVector (const string &Name)
HeaderBase ReadHeaderBase (const string &Name)
ElementContainer ReadElementContainer (const string &Name)
ElementContainerArray ReadElementContainerArray (const string &Name)
ElementContainerMatrix ReadElementContainerMatrix (const string &Name)
UInt4Container ReadUInt4Container (const string &Name)
UInt4ContainerArray ReadUInt4ContainerArray (const string &Name)
UInt4ContainerMatrix ReadUInt4ContainerMatrix (const string &Name)
template<class T >
void ReadData (const string &Name, T &t)
template<class T >
void ReadData (const string &Name, std::map< string, T > &t)
template<class T >
void ReadData (const string &Name, std::vector< T * > &t)
TwoDimElementContainer ReadTwoDimElementContainer (const string &Name)
NXstatus GetNextEntry2 (char *Name, char *nxclass, int *type)

Protected Member Functions

void OpenNeXusFile (const string &FileName)
void CloseNeXusFile ()

Protected Attributes

NXhandle handle
Int4 CurrentNumber

Detailed Description

Read NeXus binary file.

NeXus binary files can be read with this class. and NeXus C-API is utilized in this class. "ElementContainer" and the other data-container in Manyo-Lib will be constructed from NeXus file with this class. The sample codes for the Python environment is attached at the end of this file, "ReadNeXusFile.hh".


Member Function Documentation

void ReadNeXusFile::CloseData ( ) [inline]

Close data directory which is opened by "OpenData(string)".

void ReadNeXusFile::CloseGroup ( ) [inline]

Close group.

vector< string > ReadNeXusFile::GetGroupInfo ( )

Returns vector<string>, and set CurrentNumber. The size of the vector is two. "NXgetgroupinfo(....)" is executed in this method. The first element of the vector is GroupName, and that of second element is GroupClass. The second argument of "NXgetgroupinfo(....)" can extract with "PutCurrentNumber()".

vector< string > ReadNeXusFile::GetNextEntry ( )

Returns vector<string>, and set CurrentNumber. The size of the vector is two. "NXgetnextentry(......)" is executed in this method. The first and second elements of the vector are "GroupName" and "GroupClass". The second argument of "NXgetnextentry(.....)" is set into CurrentNumber, and its value is obtained with "PutCurrentNumber()".

NXstatus ReadNeXusFile::GetNextEntry2 ( char *  Name,
char *  nxclass,
int *  type 
) [inline]

call NXgetnextentry directly

Parameters:
NameNXname(char[128]) for entry name
nxclassNXname(char[128]) for class name, maybe
typemaybe a data type
Returns:
NX_OK(1), NX_ERROR(0), NX_EOD(-1)
void ReadNeXusFile::OpenData ( const string &  DataSetName)

Open data directories. The argument, "DataSetName" is obtained with "GetNextEntry()" is the name of each value.

void ReadNeXusFile::OpenGroup ( const string &  GroupName,
const string &  GroupClass 
)

Returns vector<Int4> and set CurrentNumber. The size of the vector is two. "NXgetinfo(.....)" is executed in this method. The first and second elements of the vector are Dimension and DataType. The Current number is "Rank", which is the third argument value of "NXgetinfo(.....)". "CurrentNumber" is obtained with "PutCurrentNumber()". Open groups. The first and second argument of this method will be obtained with "GetNextEntry()". The first and second element of the vector obtained with "GetNextEntry()" are set into the first and second argument of this method.

template<class T >
void ReadNeXusFile::ReadData ( const string &  Name,
T &  t 
) [inline]

proxy class to read NeXus file by using ReadData2() or ReadData1() for "version" = 2 or unversioned

Parameters:
Namename of data written in NeXus file. If this Name is "" the element name will be set automatically as "ManyoLibData".
treference to the object whose class has NXread(), be to resized and overwritten
template<class T >
void ReadNeXusFile::ReadData ( const string &  Name,
std::map< string, T > &  t 
)

template method to read a stl map of any classes

It is used to read data in Manyo's StlMapDouble (map< string, vector<Double> > M) and HeaderBase (std::map<string, int> _keymap)

Parameters:
treference to the stl map (overwritten)
template<class T >
void ReadNeXusFile::ReadData ( const string &  Name,
std::vector< T * > &  t 
)

template method to read a stl vector of pointers directly.

It is used to read data in NeutronVector (vector< T* > v).

Parameters:
treference to the stl vector, all data pointed by t[] should be written
Double ReadNeXusFile::ReadDataDouble ( const string &  Name) [inline]

Read data. The data-directory is opened and closed in this method.

Int4 ReadNeXusFile::ReadDataInt4 ( const string &  Name) [inline]

Read data. The data-directory is opened and closed in this method.

string ReadNeXusFile::ReadDataString ( const string &  Name) [inline]

Read data. The data-directory is opened and closed in this method.

UInt4 ReadNeXusFile::ReadDataUInt4 ( const string &  Name) [inline]

Read data. The data-directory is opened and closed in this method.

vector<Double> ReadNeXusFile::ReadDoubleVector ( const string &  Name) [inline]

Read data. The data-directory is opened and closed in this method.

vector<Int4> ReadNeXusFile::ReadInt4Vector ( const string &  Name) [inline]

Read data. The data-directory is opened and closed in this method.

vector<string> ReadNeXusFile::ReadStringVector ( const string &  Name) [inline]

Read data. The data-directory is opened and closed in this method.

vector<UInt4> ReadNeXusFile::ReadUInt4Vector ( const string &  Name) [inline]

Read data. The data-directory is opened and closed in this method.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Friends