NeXus  4.4.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | List of all members
NeXus::File Class Reference

The Object that allows access to the information in the file. More...

#include <NeXusFile.hpp>

Collaboration diagram for NeXus::File:
Collaboration graph

Public Member Functions

std::pair< std::string,
std::string > 
getNextEntry ()
 
AttrInfo getNextAttr ()
 
 File (const std::string &filename, const NXaccess access=NXACC_READ)
 Create a new File. More...
 
 File (const char *filename, const NXaccess access=NXACC_READ)
 Create a new File. More...
 
 File (NXhandle handle, bool close_handle=false)
 Use an existing handle returned from NXopen() More...
 
 ~File ()
 Destructor. More...
 
void close ()
 Close the file before the constructor is called. More...
 
void flush ()
 Flush the file. More...
 
template<typename NumT >
void malloc (NumT *&data, const Info &info)
 
template<typename NumT >
void free (NumT *&data)
 
void makeGroup (const std::string &name, const std::string &class_name, bool open_group=false)
 Create a new group. More...
 
void openGroup (const std::string &name, const std::string &class_name)
 Open an existing group. More...
 
void openPath (const std::string &path)
 Open the NeXus object with the path specified. More...
 
void openGroupPath (const std::string &path)
 Open the group in which the NeXus object with the specified path exists. More...
 
std::string getPath ()
 Get the path into the current file. More...
 
void closeGroup ()
 Close the currently open group. More...
 
void makeData (const std::string &name, NXnumtype type, const std::vector< int > &dims, bool open_data=false)
 
void makeData (const std::string &name, NXnumtype type, const std::vector< int64_t > &dims, bool open_data=false)
 Create a data field with the specified information. More...
 
template<typename NumT >
void makeData (const std::string &name, const NXnumtype type, const NumT length, bool open_data=false)
 Create a 1D data field with the specified information. More...
 
void writeData (const std::string &name, const std::string &value)
 Create a 1D data field, insert the data, and close the data. More...
 
void writeData (const std::string &name, const char *value)
 Create a 1D data field, insert the data, and close the data. More...
 
template<typename NumT >
void writeData (const std::string &name, const std::vector< NumT > &value)
 Create a 1D data field, insert the data, and close the data. More...
 
template<typename NumT >
void writeData (const std::string &name, const NumT &value)
 Create a 1D data field, insert the data, and close the data. More...
 
template<typename NumT >
void writeData (const std::string &name, const std::vector< NumT > &value, const std::vector< int > &dims)
 Create a n-dimension data field, insert the data, and close the data. More...
 
template<typename NumT >
void writeData (const std::string &name, const std::vector< NumT > &value, const std::vector< int64_t > &dims)
 Create a n-dimension data field, insert the data, and close the data. More...
 
template<typename NumT >
void writeExtendibleData (const std::string &name, std::vector< NumT > &value)
 Create a 1D data field with an unlimited dimension, insert the data, and close the data. More...
 
template<typename NumT >
void writeExtendibleData (const std::string &name, std::vector< NumT > &value, const int64_t chunk)
 Create a 1D data field with an unlimited dimension, insert the data, and close the data. More...
 
template<typename NumT >
void writeExtendibleData (const std::string &name, std::vector< NumT > &value, std::vector< int64_t > &dims, std::vector< int64_t > &chunk)
 Create a 1D data field with an unlimited dimension, insert the data, and close the data. More...
 
template<typename NumT >
void writeUpdatedData (const std::string &name, std::vector< NumT > &value)
 Updates the data written into an already-created data vector. More...
 
template<typename NumT >
void writeUpdatedData (const std::string &name, std::vector< NumT > &value, std::vector< int64_t > &dims)
 Updates the data written into an already-created data vector. More...
 
void makeCompData (const std::string &name, const NXnumtype type, const std::vector< int > &dims, const NXcompression comp, const std::vector< int > &bufsize, bool open_data=false)
 
void makeCompData (const std::string &name, const NXnumtype type, const std::vector< int64_t > &dims, const NXcompression comp, const std::vector< int64_t > &bufsize, bool open_data=false)
 Create a field with compression. More...
 
template<typename NumT >
void writeCompData (const std::string &name, const std::vector< NumT > &value, const std::vector< int > &dims, const NXcompression comp, const std::vector< int > &bufsize)
 
template<typename NumT >
void writeCompData (const std::string &name, const std::vector< NumT > &value, const std::vector< int64_t > &dims, const NXcompression comp, const std::vector< int64_t > &bufsize)
 Create a compressed data, insert the data, and close it. More...
 
void openData (const std::string &name)
 
void closeData ()
 Close the currently open data. More...
 
void putData (const void *data)
 
template<typename NumT >
void putData (const std::vector< NumT > &data)
 
void putAttr (const AttrInfo &info, const void *data)
 Put the supplied data as an attribute into the currently open data. More...
 
void putAttr (const std::string &name, const std::vector< std::string > &array)
 Put the supplied data as an attribute into the currently open data. More...
 
template<typename NumT >
void putAttr (const std::string &name, const std::vector< NumT > &array)
 Put the supplied data as an attribute into the currently open data. More...
 
template<typename NumT >
void putAttr (const std::string &name, const NumT value)
 Put the supplied data as an attribute into the currently open data. More...
 
void putAttr (const char *name, const char *value)
 Put a string as an attribute in the file. More...
 
void putAttr (const std::string &name, const std::string value)
 Put a string as an attribute in the file. More...
 
void putSlab (const void *data, const std::vector< int > &start, const std::vector< int > &size)
 
void putSlab (const void *data, const std::vector< int64_t > &start, const std::vector< int64_t > &size)
 Insert an array as part of a data in the final file. More...
 
template<typename NumT >
void putSlab (const std::vector< NumT > &data, const std::vector< int > &start, const std::vector< int > &size)
 
template<typename NumT >
void putSlab (const std::vector< NumT > &data, const std::vector< int64_t > &start, const std::vector< int64_t > &size)
 Insert an array as part of a data in the final file. More...
 
template<typename NumT >
void putSlab (const std::vector< NumT > &data, int start, int size)
 
template<typename NumT >
void putSlab (const std::vector< NumT > &data, int64_t start, int64_t size)
 Insert a number as part of a data in the final file. More...
 
NXlink getDataID ()
 
void makeLink (NXlink &link)
 Create a link in the current location to the supplied id. More...
 
void makeNamedLink (const std::string &name, NXlink &link)
 Create a link with a new name. More...
 
void openSourceGroup ()
 Open the original copy of this group or data as declared by the "target" attribute. More...
 
void getData (void *data)
 Put the currently open data in the supplied pointer. More...
 
template<typename NumT >
std::vector< NumT > * getData ()
 Allocate memory and return the data as a vector. More...
 
template<typename NumT >
void getData (std::vector< NumT > &data)
 Put data into the supplied vector. More...
 
void getDataCoerce (std::vector< int > &data)
 Get data and coerce into an int vector. More...
 
void getDataCoerce (std::vector< double > &data)
 Get data and coerce into a vector of doubles. More...
 
bool isDataInt ()
 Return true if the data opened is of one of the int data types, 32 bits or less. More...
 
template<typename NumT >
void readData (const std::string &dataName, std::vector< NumT > &data)
 Put data into the supplied vector. More...
 
template<typename NumT >
void readData (const std::string &dataName, NumT &data)
 Put data into the supplied value. More...
 
void readData (const std::string &dataName, std::string &data)
 Put data into the supplied string. More...
 
std::string getStrData ()
 
Info getInfo ()
 
std::map< std::string,
std::string > 
getEntries ()
 Return the entries available in the current place in the file. More...
 
void getEntries (std::map< std::string, std::string > &result)
 Return the entries available in the current place in the file, but avoids the map copy of getEntries(). More...
 
void getSlab (void *data, const std::vector< int > &start, const std::vector< int > &size)
 
void getSlab (void *data, const std::vector< int64_t > &start, const std::vector< int64_t > &size)
 Get a section of data from the file. More...
 
std::vector< AttrInfogetAttrInfos ()
 
bool hasAttr (const std::string &name)
 
void getAttr (const AttrInfo &info, void *data, int length=-1)
 Get the value of the attribute specified by the AttrInfo supplied. More...
 
template<typename NumT >
NumT getAttr (const AttrInfo &info)
 Get the value of an attribute that is a scalar number. More...
 
template<typename NumT >
void getAttr (const std::string &name, NumT &value)
 Get the value of an attribute that is a scalar number. More...
 
std::string getStrAttr (const AttrInfo &info)
 Get the value of a string attribute. More...
 
void getAttr (const std::string &name, std::vector< std::string > &array)
 Get the value of a string array attribute. More...
 
NXlink getGroupID ()
 
bool sameID (NXlink &first, NXlink &second)
 Determine whether or not two links refer to the same data or group. More...
 
void printLink (NXlink &link)
 Diagnostic print of the link information. More...
 
void setNumberFormat (NXnumtype &type, const std::string &format)
 Set the number format used for a particular type when using the xml base. More...
 
std::string inquireFile (const int buff_length=NX_MAXPATHLEN)
 Find out the name of the file this object is holding onto. More...
 
std::string isExternalGroup (const std::string &name, const std::string &type, const unsigned buff_length=NX_MAXNAMELEN)
 Determine Whether or not a supplied group is external. More...
 
void linkExternal (const std::string &name, const std::string &type, const std::string &url)
 Create a link to a group in an external file. More...
 
bool isDataSetOpen ()
 This function checksi if we are in an open dataset. More...
 
TypeMapgetTypeMap ()
 Create a multimap with the data types as keys and the associated paths as values. More...
 
template<>
void getAttr (const std::string &name, std::string &value)
 

Detailed Description

The Object that allows access to the information in the file.

Examples:
napi_test_cpp.cxx.

Definition at line 96 of file NeXusFile.hpp.

Constructor & Destructor Documentation

NeXus::File::File ( const std::string &  filename,
const NXaccess  access = NXACC_READ 
)

Create a new File.

Parameters
filenameThe name of the file to open.
accessHow to access the file.

Definition at line 171 of file NeXusFile.cpp.

NeXus::File::File ( const char *  filename,
const NXaccess  access = NXACC_READ 
)

Create a new File.

Parameters
filenameThe name of the file to open.
accessHow to access the file.

Definition at line 175 of file NeXusFile.cpp.

NeXus::File::File ( NXhandle  handle,
bool  close_handle = false 
)

Use an existing handle returned from NXopen()

Parameters
handleHandle to connect to
close_handleShould the handle be closed on destruction

Definition at line 168 of file NeXusFile.cpp.

NeXus::File::~File ( )

Destructor.

This does close the file.

Definition at line 192 of file NeXusFile.cpp.

Member Function Documentation

void NeXus::File::close ( )

Close the file before the constructor is called.

Definition at line 204 of file NeXusFile.cpp.

void NeXus::File::closeData ( )
void NeXus::File::closeGroup ( )

Close the currently open group.

Definition at line 293 of file NeXusFile.cpp.

Referenced by NeXus::Stream::operator<<(), and NeXus::Stream::operator>>().

void NeXus::File::flush ( )

Flush the file.

Definition at line 214 of file NeXusFile.cpp.

template<typename NumT >
template void File::free ( NumT *&  data)

Definition at line 1463 of file NeXusFile.cpp.

void NeXus::File::getAttr ( const AttrInfo info,
void *  data,
int  length = -1 
)

Get the value of the attribute specified by the AttrInfo supplied.

Parameters
infoDesignation of which attribute to read.
dataThe pointer to put the attribute value in.
lengthThe length of the attribute. If this is "-1" then the information in the supplied AttrInfo object will be used.

Definition at line 1151 of file NeXusFile.cpp.

References NeXus::AttrInfo::length, NeXus::AttrInfo::name, and NeXus::AttrInfo::type.

Referenced by getAttr(), getStrAttr(), and NeXus::Stream::AttrHolder< NumT >::readFromFile().

template<typename NumT >
template char File::getAttr ( const AttrInfo info)

Get the value of an attribute that is a scalar number.

Parameters
infoDesignation of which attribute to read.
Template Parameters
NumTnumeric data type of result
Returns
The attribute value.

Definition at line 1181 of file NeXusFile.cpp.

References getAttr().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::getAttr ( const std::string &  name,
NumT &  value 
)

Get the value of an attribute that is a scalar number.

Parameters
[in]nameName of attribute to read
[out]valueThe read attribute value.
Template Parameters
NumTnumeric data type of value

Definition at line 1198 of file NeXusFile.cpp.

References NeXus::AttrInfo::length, NeXus::AttrInfo::name, and NeXus::AttrInfo::type.

void NeXus::File::getAttr ( const std::string &  name,
std::vector< std::string > &  array 
)

Get the value of a string array attribute.

Parameters
infoWhich attribute to read.
arrayThe values of the attribute.

Definition at line 1236 of file NeXusFile.cpp.

template<>
void NeXus::File::getAttr ( const std::string &  name,
std::string &  value 
)

<

Todo:
need to find correct length of attribute

Definition at line 1188 of file NeXusFile.cpp.

References getStrAttr(), NeXus::AttrInfo::length, NeXus::AttrInfo::name, and NeXus::AttrInfo::type.

Here is the call graph for this function:

vector< AttrInfo > NeXus::File::getAttrInfos ( )
Returns
Information about all attributes on the data that is currently open.

Definition at line 1278 of file NeXusFile.cpp.

References getNextAttr(), and NeXus::AttrInfo::name.

Here is the call graph for this function:

void NeXus::File::getData ( void *  data)

Put the currently open data in the supplied pointer.

Parameters
dataThe pointer to copy the data to.

Definition at line 773 of file NeXusFile.cpp.

Referenced by NeXus::Stream::DataHolder< NumT >::readFromFile().

template<typename NumT >
template vector< char > * File::getData ( )

Allocate memory and return the data as a vector.

Since this does call "new vector<NumT>" the caller is responsible for calling "delete".

Template Parameters
NumTnumeric data type of result
Returns
The data as a vector.

Definition at line 784 of file NeXusFile.cpp.

References NeXus::Info::dims, getInfo(), and NeXus::Info::type.

Referenced by getData(), getDataCoerce(), getStrData(), and readData().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::getData ( std::vector< NumT > &  data)

Put data into the supplied vector.

The vector does not need to be the correct size, just the correct type as it is resized to the appropriate value.

Parameters
dataWhere to put the data.
Template Parameters
NumTnumeric data type of data

Definition at line 814 of file NeXusFile.cpp.

References NeXus::Info::dims, getData(), getInfo(), and NeXus::Info::type.

Here is the call graph for this function:

void NeXus::File::getDataCoerce ( std::vector< int > &  data)

Get data and coerce into an int vector.

Exceptions
Exceptionif the data is actually a float or another type that cannot be coerced to an int.
Parameters
data:: vector to be filled.

Definition at line 837 of file NeXusFile.cpp.

References getData(), getInfo(), NeXus::INT16, NeXus::INT32, NeXus::INT8, NeXus::Info::type, NeXus::UINT16, NeXus::UINT32, and NeXus::UINT8.

Here is the call graph for this function:

void NeXus::File::getDataCoerce ( std::vector< double > &  data)

Get data and coerce into a vector of doubles.

Exceptions
Exceptionif the data cannot be coerced to a double.
Parameters
data:: vector to be filled.

Definition at line 882 of file NeXusFile.cpp.

References NeXus::FLOAT32, NeXus::FLOAT64, getData(), getInfo(), NeXus::INT16, NeXus::INT32, NeXus::INT8, NeXus::Info::type, NeXus::UINT16, NeXus::UINT32, and NeXus::UINT8.

Here is the call graph for this function:

NXlink NeXus::File::getDataID ( )
Returns
The id of the data used for linking.

Definition at line 726 of file NeXusFile.cpp.

map< string, string > NeXus::File::getEntries ( )

Return the entries available in the current place in the file.

Definition at line 1049 of file NeXusFile.cpp.

void NeXus::File::getEntries ( std::map< std::string, std::string > &  result)

Return the entries available in the current place in the file, but avoids the map copy of getEntries().

Parameters
resultThe map that will be filled with the entries

Definition at line 1056 of file NeXusFile.cpp.

References getNextEntry().

Here is the call graph for this function:

NXlink NeXus::File::getGroupID ( )
Returns
The id of the group used for linking.

Definition at line 1308 of file NeXusFile.cpp.

Info NeXus::File::getInfo ( )
Returns
The Info structure that describes the currently open data.

Definition at line 1011 of file NeXusFile.cpp.

References NeXus::Info::dims, and NeXus::Info::type.

Referenced by getData(), getDataCoerce(), getStrData(), and isDataInt().

AttrInfo NeXus::File::getNextAttr ( )
Returns
Information about the next attribute.

Definition at line 1102 of file NeXusFile.cpp.

References NeXus::AttrInfo::dims, NeXus::AttrInfo::length, NeXus::AttrInfo::name, and NeXus::AttrInfo::type.

Referenced by getAttrInfos(), and hasAttr().

pair< string, string > NeXus::File::getNextEntry ( )
Returns
A pair of the next entry available in a listing.

Definition at line 1028 of file NeXusFile.cpp.

Referenced by getEntries().

std::string NeXus::File::getPath ( )

Get the path into the current file.

Returns
A unix like path string pointing to the current position in the file

Definition at line 280 of file NeXusFile.cpp.

void NeXus::File::getSlab ( void *  data,
const std::vector< int > &  start,
const std::vector< int > &  size 
)

Parameters
dataThe pointer to insert that data into.
startThe offset into the file's data block to start the read from.
sizeThe size of the block to read from the file.

Definition at line 1073 of file NeXusFile.cpp.

void NeXus::File::getSlab ( void *  data,
const std::vector< int64_t > &  start,
const std::vector< int64_t > &  size 
)

Get a section of data from the file.

Parameters
dataThe pointer to insert that data into.
startThe offset into the file's data block to start the read from.
sizeThe size of the block to read from the file.

Definition at line 1078 of file NeXusFile.cpp.

string NeXus::File::getStrAttr ( const AttrInfo info)

Get the value of a string attribute.

Parameters
infoWhich attribute to read.
Returns
The value of the attribute.

Definition at line 1208 of file NeXusFile.cpp.

References NeXus::CHAR, getAttr(), NeXus::AttrInfo::length, and NeXus::AttrInfo::type.

Referenced by getAttr().

Here is the call graph for this function:

string NeXus::File::getStrData ( )
Returns
String data from the file.

Definition at line 982 of file NeXusFile.cpp.

References NeXus::Info::dims, getData(), getInfo(), and NeXus::Info::type.

Referenced by readData().

Here is the call graph for this function:

TypeMap * NeXus::File::getTypeMap ( )

Create a multimap with the data types as keys and the associated paths as values.

Returns
The multimap of the opened file.

Definition at line 1444 of file NeXusFile.cpp.

References openPath().

Here is the call graph for this function:

bool NeXus::File::hasAttr ( const std::string &  name)
Returns
true if the current point in the file has the named attribute
Parameters
namethe name of the attribute to look for.

Definition at line 1292 of file NeXusFile.cpp.

References getNextAttr(), and NeXus::AttrInfo::name.

Here is the call graph for this function:

string NeXus::File::inquireFile ( const int  buff_length = NX_MAXPATHLEN)

Find out the name of the file this object is holding onto.

Parameters
buff_lengthThe size of the buffer to use for reading the name.
Returns
The name of the file.

Definition at line 1357 of file NeXusFile.cpp.

bool NeXus::File::isDataInt ( )

Return true if the data opened is of one of the int data types, 32 bits or less.

Definition at line 963 of file NeXusFile.cpp.

References getInfo(), NeXus::INT16, NeXus::INT32, NeXus::INT8, NeXus::Info::type, NeXus::UINT16, NeXus::UINT32, and NeXus::UINT8.

Here is the call graph for this function:

bool NeXus::File::isDataSetOpen ( )

This function checksi if we are in an open dataset.

Returns
true if we are currently in an open dataset else false

Definition at line 735 of file NeXusFile.cpp.

Referenced by NeXus::Stream::operator<<(), and NeXus::Stream::operator>>().

string NeXus::File::isExternalGroup ( const std::string &  name,
const std::string &  type,
const unsigned  buff_length = NX_MAXNAMELEN 
)

Determine Whether or not a supplied group is external.

Parameters
nameThe name of the group to check.
typeThe type of the group to check.
buff_lengthThe size of the buffer to use for reading the url.
Returns
The url to the external group.

Definition at line 1372 of file NeXusFile.cpp.

void NeXus::File::linkExternal ( const std::string &  name,
const std::string &  type,
const std::string &  url 
)

Create a link to a group in an external file.

Parameters
nameThe name for the group in this file.
typeThe type for the group in this file.
urlThe url to the group in the external file.

Definition at line 1395 of file NeXusFile.cpp.

void NeXus::File::makeCompData ( const std::string &  name,
const NXnumtype  type,
const std::vector< int > &  dims,
const NXcompression  comp,
const std::vector< int > &  bufsize,
bool  open_data = false 
)

Parameters
nameThe name of the data to create.
typeThe primitive type for the data.
dimsThe dimensions of the data.
compThe compression algorithm to use.
bufsizeThe size of the compression buffer to use.
open_dataWhether or not to open the data after creating it.

Definition at line 442 of file NeXusFile.cpp.

Referenced by writeCompData(), and writeExtendibleData().

void NeXus::File::makeCompData ( const std::string &  name,
const NXnumtype  type,
const std::vector< int64_t > &  dims,
const NXcompression  comp,
const std::vector< int64_t > &  bufsize,
bool  open_data = false 
)

Create a field with compression.

Parameters
nameThe name of the data to create.
typeThe primitive type for the data.
dimsThe dimensions of the data.
compThe compression algorithm to use.
bufsizeThe size of the compression buffer to use.
open_dataWhether or not to open the data after creating it.

Definition at line 448 of file NeXusFile.cpp.

References openData().

Here is the call graph for this function:

void NeXus::File::makeData ( const std::string &  name,
NXnumtype  type,
const std::vector< int > &  dims,
bool  open_data = false 
)

Parameters
nameThe name of the field to create (i.e. "distance").
typeThe primative type of the field (i.e. "NeXus::FLOAT32").
dimsThe dimensions of the field.
open_dataWhether or not to open the data after creating it.

Definition at line 300 of file NeXusFile.cpp.

Referenced by makeData(), and writeData().

void NeXus::File::makeData ( const std::string &  name,
NXnumtype  type,
const std::vector< int64_t > &  dims,
bool  open_data = false 
)

Create a data field with the specified information.

Parameters
nameThe name of the field to create (i.e. "distance").
typeThe primative type of the field (i.e. "NeXus::FLOAT32").
dimsThe dimensions of the field.
open_dataWhether or not to open the data after creating it.

Definition at line 305 of file NeXusFile.cpp.

References openData().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::makeData ( const std::string &  name,
const NXnumtype  type,
const NumT  length,
bool  open_data = false 
)

Create a 1D data field with the specified information.

Parameters
nameThe name of the field to create (i.e. "distance").
typeThe primative type of the field (i.e. "NeXus::FLOAT32").
lengthThe number of elements in the field.
open_dataWhether or not to open the data after creating it.

Definition at line 331 of file NeXusFile.cpp.

References makeData().

Here is the call graph for this function:

void NeXus::File::makeGroup ( const std::string &  name,
const std::string &  class_name,
bool  open_group = false 
)

Create a new group.

Parameters
nameThe name of the group to create (i.e. "entry").
class_nameThe type of group to create (i.e. "NXentry").
open_groupWhether or not to automatically open the group after creating it.

Definition at line 221 of file NeXusFile.cpp.

References openGroup().

Referenced by NeXus::Stream::Group::writeToFile().

Here is the call graph for this function:

void NeXus::File::makeLink ( NXlink &  link)

Create a link in the current location to the supplied id.

Parameters
linkThe object (group or data) in the file to link to.

Definition at line 749 of file NeXusFile.cpp.

void NeXus::File::makeNamedLink ( const std::string &  name,
NXlink &  link 
)

Create a link with a new name.

Parameters
nameThe name of this copy of the link.
linkThe object (group or data) in the file to link to.

Definition at line 756 of file NeXusFile.cpp.

template<typename NumT >
template void File::malloc ( NumT *&  data,
const Info info 
)

Definition at line 1453 of file NeXusFile.cpp.

References NeXus::Info::dims, and NeXus::Info::type.

void NeXus::File::openData ( const std::string &  name)
void NeXus::File::openGroup ( const std::string &  name,
const std::string &  class_name 
)

Open an existing group.

Parameters
nameThe name of the group to create (i.e. "entry").
class_nameThe type of group to create (i.e. "NXentry").

Definition at line 240 of file NeXusFile.cpp.

Referenced by makeGroup(), and NeXus::Stream::Group::readFromFile().

void NeXus::File::openGroupPath ( const std::string &  path)

Open the group in which the NeXus object with the specified path exists.

Parameters
pathA unix like path string to a group or field. The path string is a list of group names and SDS names separated with a slash, '/' (i.e. "/entry/sample/name").

Definition at line 268 of file NeXusFile.cpp.

void NeXus::File::openPath ( const std::string &  path)

Open the NeXus object with the path specified.

Parameters
pathA unix like path string to a group or field. The path string is a list of group names and SDS names separated with a slash, '/' (i.e. "/entry/sample/name").

Definition at line 256 of file NeXusFile.cpp.

Referenced by getTypeMap().

void NeXus::File::openSourceGroup ( )

Open the original copy of this group or data as declared by the "target" attribute.

Definition at line 766 of file NeXusFile.cpp.

void NeXus::File::printLink ( NXlink &  link)

Diagnostic print of the link information.

Parameters
linkThe link to print to stdout.

Definition at line 1322 of file NeXusFile.cpp.

void NeXus::File::putAttr ( const AttrInfo info,
const void *  data 
)

Put the supplied data as an attribute into the currently open data.

Parameters
infoDescription of the attribute to add.
dataThe attribute value.

Definition at line 547 of file NeXusFile.cpp.

References NeXus::AttrInfo::length, NeXus::AttrInfo::name, and NeXus::AttrInfo::type.

Referenced by putAttr(), and NeXus::Stream::AttrHolder< NumT >::writeToFile().

void NeXus::File::putAttr ( const std::string &  name,
const std::vector< std::string > &  array 
)

Put the supplied data as an attribute into the currently open data.

Parameters
nameName of the attribute to add.
arrayThe attribute value.

Definition at line 565 of file NeXusFile.cpp.

References NeXus::CHAR.

template<typename NumT >
void NeXus::File::putAttr ( const std::string &  name,
const std::vector< NumT > &  array 
)

Put the supplied data as an attribute into the currently open data.

Parameters
nameName of the attribute to add.
arrayThe attribute value.

Definition at line 608 of file NeXusFile.cpp.

template<typename NumT >
void NeXus::File::putAttr ( const std::string &  name,
const NumT  value 
)

Put the supplied data as an attribute into the currently open data.

Parameters
nameName of the attribute to add.
valueThe attribute value.
Template Parameters
NumTnumeric data type of value

Definition at line 634 of file NeXusFile.cpp.

References NeXus::AttrInfo::length, NeXus::AttrInfo::name, putAttr(), and NeXus::AttrInfo::type.

Here is the call graph for this function:

void NeXus::File::putAttr ( const char *  name,
const char *  value 
)

Put a string as an attribute in the file.

Parameters
nameName of the attribute to add.
valueThe attribute value.

Definition at line 642 of file NeXusFile.cpp.

References putAttr().

Here is the call graph for this function:

void NeXus::File::putAttr ( const std::string &  name,
const std::string  value 
)

Put a string as an attribute in the file.

Parameters
nameName of the attribute to add.
valueThe attribute value.

Definition at line 654 of file NeXusFile.cpp.

References NeXus::CHAR, NeXus::AttrInfo::length, NeXus::AttrInfo::name, putAttr(), and NeXus::AttrInfo::type.

Here is the call graph for this function:

void NeXus::File::putData ( const void *  data)
Parameters
dataThe data to put in the file.

Definition at line 529 of file NeXusFile.cpp.

Referenced by putData(), writeCompData(), and writeData().

template<typename NumT >
void NeXus::File::putData ( const std::vector< NumT > &  data)
Parameters
dataThe data to put in the file.
Template Parameters
NumTnumeric data type of data

Definition at line 540 of file NeXusFile.cpp.

References putData().

Here is the call graph for this function:

void NeXus::File::putSlab ( const void *  data,
const std::vector< int > &  start,
const std::vector< int > &  size 
)

Definition at line 665 of file NeXusFile.cpp.

Referenced by putSlab(), writeExtendibleData(), and writeUpdatedData().

void NeXus::File::putSlab ( const void *  data,
const std::vector< int64_t > &  start,
const std::vector< int64_t > &  size 
)

Insert an array as part of a data in the final file.

Parameters
dataThe array to put in the file.
startThe starting index to insert the data.
sizeThe size of the array to put in the file.

Definition at line 671 of file NeXusFile.cpp.

template<typename NumT >
void NeXus::File::putSlab ( const std::vector< NumT > &  data,
const std::vector< int > &  start,
const std::vector< int > &  size 
)

Definition at line 698 of file NeXusFile.cpp.

References putSlab().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::putSlab ( const std::vector< NumT > &  data,
const std::vector< int64_t > &  start,
const std::vector< int64_t > &  size 
)

Insert an array as part of a data in the final file.

Parameters
dataThe array to put in the file.
startThe starting index to insert the data.
sizeThe size of the array to put in the file.
Template Parameters
NumTnumeric data type of data

Definition at line 706 of file NeXusFile.cpp.

References putSlab().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::putSlab ( const std::vector< NumT > &  data,
int  start,
int  size 
)

Definition at line 715 of file NeXusFile.cpp.

References putSlab().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::putSlab ( const std::vector< NumT > &  data,
int64_t  start,
int64_t  size 
)

Insert a number as part of a data in the final file.

Parameters
dataThe array to put in the file.
startThe starting index to insert the data.
sizeThe size of the array to put in the file.
Template Parameters
NumTnumeric data type of data

Definition at line 720 of file NeXusFile.cpp.

References putSlab().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::readData ( const std::string &  dataName,
std::vector< NumT > &  data 
)

Put data into the supplied vector.

The vector does not need to be the correct size, just the correct type as it is resized to the appropriate value.

The named data object is opened, loaded, then closed.

Parameters
dataName:: name of the data to open.
data:: Where to put the data.
Template Parameters
NumTnumeric data type of data

Definition at line 938 of file NeXusFile.cpp.

References closeData(), getData(), and openData().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::readData ( const std::string &  dataName,
NumT &  data 
)

Put data into the supplied value.

The named data object is opened, loaded, then closed.

Parameters
dataName:: name of the data to open.
data:: Where to put the data.
Template Parameters
NumTnumeric data type of data

Definition at line 946 of file NeXusFile.cpp.

References closeData(), getData(), and openData().

Here is the call graph for this function:

void NeXus::File::readData ( const std::string &  dataName,
std::string &  data 
)

Put data into the supplied string.

The vector does not need to be the correct size, just the correct type as it is resized to the appropriate value.

The named data object is opened, loaded, then closed.

Parameters
dataName:: name of the data to open.
data:: Where to put the data.

Definition at line 956 of file NeXusFile.cpp.

References closeData(), getStrData(), and openData().

Here is the call graph for this function:

bool NeXus::File::sameID ( NXlink &  first,
NXlink &  second 
)

Determine whether or not two links refer to the same data or group.

Parameters
firstThe first link information to compare.
secondThe second link information to compare.
Returns
True if the two point at the same data or group.

Definition at line 1317 of file NeXusFile.cpp.

void NeXus::File::setNumberFormat ( NXnumtype type,
const std::string &  format 
)

Set the number format used for a particular type when using the xml base.

This is ignore in the other bases.

Parameters
typeThe primitive type to set the format for.
formatThe format to use.

Definition at line 1343 of file NeXusFile.cpp.

template<typename NumT >
void NeXus::File::writeCompData ( const std::string &  name,
const std::vector< NumT > &  value,
const std::vector< int > &  dims,
const NXcompression  comp,
const std::vector< int > &  bufsize 
)

Parameters
nameThe name of the data to create.
valueThe vector to put into the file.
dimsThe dimensions of the data.
compThe compression algorithm to use.
bufsizeThe size of the compression buffer to use.
Template Parameters
NumTnumeric data type of value

Definition at line 491 of file NeXusFile.cpp.

template<typename NumT >
void NeXus::File::writeCompData ( const std::string &  name,
const std::vector< NumT > &  value,
const std::vector< int64_t > &  dims,
const NXcompression  comp,
const std::vector< int64_t > &  bufsize 
)

Create a compressed data, insert the data, and close it.

Parameters
nameThe name of the data to create.
valueThe vector to put into the file.
dimsThe dimensions of the data.
compThe compression algorithm to use.
bufsizeThe size of the compression buffer to use.
Template Parameters
NumTnumeric data type of value

Definition at line 498 of file NeXusFile.cpp.

References closeData(), makeCompData(), and putData().

Here is the call graph for this function:

void NeXus::File::writeData ( const std::string &  name,
const std::string &  value 
)

Create a 1D data field, insert the data, and close the data.

Parameters
nameThe name of the field to create.
valueThe string to put into the file.

Definition at line 348 of file NeXusFile.cpp.

References NeXus::CHAR, closeData(), makeData(), and putData().

Referenced by writeData(), and NeXus::Stream::DataHolder< NumT >::writeToFile().

Here is the call graph for this function:

void NeXus::File::writeData ( const std::string &  name,
const char *  value 
)

Create a 1D data field, insert the data, and close the data.

Parameters
nameThe name of the field to create.
valueThe string to put into the file.

Definition at line 344 of file NeXusFile.cpp.

References writeData().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::writeData ( const std::string &  name,
const std::vector< NumT > &  value 
)

Create a 1D data field, insert the data, and close the data.

Template Parameters
NumTnumeric data type of value
Parameters
nameThe name of the field to create.
valueThe vector to put into the file.

Definition at line 366 of file NeXusFile.cpp.

References writeData().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::writeData ( const std::string &  name,
const NumT &  value 
)

Create a 1D data field, insert the data, and close the data.

Template Parameters
NumTnumeric data type of value
Parameters
nameThe name of the field to create.
valueThe value to put into the file.

Definition at line 339 of file NeXusFile.cpp.

References writeData().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::writeData ( const std::string &  name,
const std::vector< NumT > &  value,
const std::vector< int > &  dims 
)

Create a n-dimension data field, insert the data, and close the data.

Parameters
nameThe name of the field to create.
valueThe data to put into the file.
dimsThe dimensions of the data.
Template Parameters
NumTnumeric data type of value

Definition at line 372 of file NeXusFile.cpp.

References closeData(), makeData(), and putData().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::writeData ( const std::string &  name,
const std::vector< NumT > &  value,
const std::vector< int64_t > &  dims 
)

Create a n-dimension data field, insert the data, and close the data.

Parameters
nameThe name of the field to create.
valueThe data to put into the file.
dimsThe dimensions of the data.
Template Parameters
NumTnumeric data type of value

Definition at line 380 of file NeXusFile.cpp.

References closeData(), makeData(), and putData().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::writeExtendibleData ( const std::string &  name,
std::vector< NumT > &  value 
)

Create a 1D data field with an unlimited dimension, insert the data, and close the data.

Template Parameters
NumTnumeric data type of value
Parameters
name:: The name of the field to create.
value:: The vector to put into the file.

Definition at line 389 of file NeXusFile.cpp.

template<typename NumT >
void NeXus::File::writeExtendibleData ( const std::string &  name,
std::vector< NumT > &  value,
const int64_t  chunk 
)

Create a 1D data field with an unlimited dimension, insert the data, and close the data.

Template Parameters
NumTnumeric data type of value
Parameters
name:: The name of the field to create.
value:: The vector to put into the file.
chunkSize:: chunk size to use when writing

Definition at line 396 of file NeXusFile.cpp.

References closeData(), makeCompData(), NeXus::NONE, and putSlab().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::writeExtendibleData ( const std::string &  name,
std::vector< NumT > &  value,
std::vector< int64_t > &  dims,
std::vector< int64_t > &  chunk 
)

Create a 1D data field with an unlimited dimension, insert the data, and close the data.

Template Parameters
NumTnumeric data type of value
Parameters
name:: The name of the field to create.
value:: The vector to put into the file.
dims:: The dimensions of the data.
chunk:: chunk size to use when writing

Definition at line 407 of file NeXusFile.cpp.

References closeData(), makeCompData(), NeXus::NONE, and putSlab().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::writeUpdatedData ( const std::string &  name,
std::vector< NumT > &  value 
)

Updates the data written into an already-created data vector.

If the data was created as extendible, it will be resized.

Template Parameters
NumTnumeric data type of value
Parameters
name:: The name of the field to create.
value:: The vector to put into the file.

Definition at line 424 of file NeXusFile.cpp.

References closeData(), openData(), and putSlab().

Here is the call graph for this function:

template<typename NumT >
void NeXus::File::writeUpdatedData ( const std::string &  name,
std::vector< NumT > &  value,
std::vector< int64_t > &  dims 
)

Updates the data written into an already-created data vector.

If the data was created as extendible, it will be resized.

Template Parameters
NumTnumeric data type of value
Parameters
name:: The name of the field to create.
value:: The vector to put into the file.
dims:: The dimensions of the data.

Definition at line 432 of file NeXusFile.cpp.

References closeData(), openData(), and putSlab().

Here is the call graph for this function:


The documentation for this class was generated from the following files: