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

Make Binary data in NeXus format. More...

#include <WriteNeXusFile.hh>

List of all members.

Public Member Functions

 WriteNeXusFile (const string &FileName, const string &UserName="UserName", UInt4 CompMode=1)
 WriteNeXusFile (NXhandle r_handle, UInt4 CompMode=1)
 ~WriteNeXusFile ()
NXhandle PutHandle ()
NXlink PutLink ()
void CloseNeXusFile ()
void AppendAttribute (const string &Name, string value)
void AppendAttribute (const string &Name, UInt4 value)
void AppendAttribute (const string &Name, Int4 value)
void AppendAttribute (const string &Name, Double value)
void AppendAttribute (const string &Name, vector< Int4 > value)
void AppendAttribute (const string &Name, vector< Double > value)
void AppendAttribute (const string &Name, vector< string > value)
void AppendAttribute (HeaderBase *header)
void MakeOpenGroup (const string &Name, string Class)
void CloseGroup ()
void CloseData ()
template<class T >
void WriteData (const string &Name, const T &t)
template<class T >
void WriteData (const string &Name, const std::vector< T * > &t)
template<class T >
void WriteData (const string &Name, const std::map< string, T > &t)
void WriteData (const string &Name, UInt4 value)
void WriteData (const string &Name, Int4 value)
void WriteData (const string &Name, Double value)
void WriteData (const string &Name, string value)
void WriteData (const string &Name, const UInt4 *value, UInt4 size)
void WriteData (const string &Name, const Int4 *value, UInt4 size)
void WriteData (const string &Name, const Double *value, UInt4 size)
void WriteData (const string &Name, const vector< string > &value)
void WriteData (const string &Name, const vector< UInt4 > &value)
void WriteData (const string &Name, const vector< Int4 > &value)
void WriteData (const string &Name, const vector< Double > &value)
void WriteData1 (const string &Name, ElementContainer EC)
void WriteData1 (const string &Name, HeaderBase Header)
void WriteData1 (const string &Name, ElementContainerArray ECA)
void WriteData1 (const string &Name, ElementContainerMatrix ECM)
void WriteData1 (const string &Name, UInt4ContainerMatrix UCM)
void WriteData1 (const string &Name, UInt4ContainerArray UCA)
void WriteData1 (const string &Name, UInt4Container UC)
void WriteData1 (const string &Name, TwoDimElementContainer TDEC)
void MakeLink (NXlink Link)

Protected Member Functions

void CreateNeXusFile (const string &FileName, const string &UserName)

Protected Attributes

NXhandle handle
NXlink link

Detailed Description

Make Binary data in NeXus format.

This class make binary data in NeXus format. The API of NeXus is only provided for JAVA, Fortrun and C-language. NeXus data files will be written with this class on C++ and python language. The test codes utilized with this class is attached this file, "WriteNeXusFile.hh".

If you want to make NeXus files compressed by the gzip library, see the comment of the constructor.


Constructor & Destructor Documentation

WriteNeXusFile::WriteNeXusFile ( const string &  FileName,
const string &  UserName = "UserName",
UInt4  CompMode = 1 
)

Constructor. Set output file-name and your user-name. If CompMode is 1 or omitted, the output data file will be compressed with the gzip library. If it is not 1, the output file will not be compressed.

Parameters:
CompMode0, 1(default) for NX_COMP_NONE or NX_COMPLZW

Destructor, NeXus binary file is closed in this method.


Member Function Documentation

"NXclosedata(.....) is called in this method."

"NXclosegroup(.....) is called in this method."

void WriteNeXusFile::MakeLink ( NXlink  Link)

This method is not effective, because the function of link is not prepared in NeXus API. The function of "NXgetgroupID()" is not work, but "NXgetdataID() can be work well. "

void WriteNeXusFile::MakeOpenGroup ( const string &  Name,
string  Class 
)

make and open directory of XML. "NXmakegroup(.......)" and "NXopengroup(......)" are called in this method.

template<class T >
void WriteNeXusFile::WriteData ( const string &  Name,
const T &  t 
)

template method to write any class with NeXus format by calling their method T::NXwrite()

WriteNeXusFile should be a friend class of each class. Each T::NXwrite() methods write their data by calling WriteNeXusFile::WriteData() method recursively.

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 NXwrite().
template<class T >
void WriteNeXusFile::WriteData ( const string &  Name,
const std::vector< T * > &  t 
)

template method to write a stl vector of pointers directly.

It is used to write data in UInt4Container (vector<vector<double> *> vd).

Parameters:
treference to the stl vector, all data pointed by t[] should be written
template<class T >
void WriteNeXusFile::WriteData ( const string &  Name,
const std::map< string, T > &  t 
)

template method to write a stl map of any classes

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

Parameters:
treference to the stl map
void WriteNeXusFile::WriteData ( const string &  Name,
UInt4  value 
)

< Write data only with attribute, "Name". Write data with its name.

void WriteNeXusFile::WriteData ( const string &  Name,
Int4  value 
)

Write data with its name.

void WriteNeXusFile::WriteData ( const string &  Name,
Double  value 
)

Write data with its name.

void WriteNeXusFile::WriteData ( const string &  Name,
string  value 
)

Write data with its name.

void WriteNeXusFile::WriteData ( const string &  Name,
const UInt4 *  value,
UInt4  size 
)

Write data with its name.

void WriteNeXusFile::WriteData ( const string &  Name,
const Int4 *  value,
UInt4  size 
)

Write data with its name.

void WriteNeXusFile::WriteData ( const string &  Name,
const Double *  value,
UInt4  size 
)

Write data with its name.

void WriteNeXusFile::WriteData ( const string &  Name,
const vector< string > &  value 
)

Write data with its name.

void WriteNeXusFile::WriteData ( const string &  Name,
const vector< UInt4 > &  value 
)

Write data with its name.

void WriteNeXusFile::WriteData ( const string &  Name,
const vector< Int4 > &  value 
)

Write data with its name.

void WriteNeXusFile::WriteData ( const string &  Name,
const vector< Double > &  value 
)

Write data with its name.

void WriteNeXusFile::WriteData1 ( const string &  Name,
ElementContainer  EC 
)

Write data with its name. If the first argument is "", the element name will be set automatically as "ElementContainer".

void WriteNeXusFile::WriteData1 ( const string &  Name,
HeaderBase  Header 
)

Write data with its name. If the first argument is "", the element name will be set automatically as "HeaderBase".

void WriteNeXusFile::WriteData1 ( const string &  Name,
ElementContainerArray  ECA 
)

Write data with its name. If the first argument is "", the element name will be set automatically as "ElementContainerArray".

void WriteNeXusFile::WriteData1 ( const string &  Name,
ElementContainerMatrix  ECM 
)

Write data with its name. If the first argument is "", the element name will be set automatically as "ElementContainerArray".


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