AGX Dynamics 2.37.3.3
Loading...
Searching...
No Matches
agxIO Namespace Reference

The agxIO namespace contains classes for reading, writing and finding files. More...

Classes

class  ArgumentParser
 A small argument parser class. More...
 
class  Environment
 Class for setting search path for locating dynamic libraries, scripts etc. More...
 
struct  FileExtension
 Support mesh file formats. More...
 
class  FilePathContainer
 class for locating files More...
 
class  FileState
 Class for storing and comparing a change date for a file on disk. More...
 
class  FileStateVector
 vector for holding a set of file states, where the vector can be asked if any of the files has been changed. More...
 
struct  FileSystem
 
class  Image
 Class to represent Images. More...
 
class  ImageReader
 Base class for ImageReaders. More...
 
class  ImageReaderPNG
 ImageReader for png-files. More...
 
class  KeyEvent
 
class  MeshReader
 Class for reading a mesh object from file and extracting vertices, normals and indices for collision detection Notice that this class will read the mesh vertices/indices as is. More...
 
class  MeshReaderOBJ
 Class for reading a Wavefront OBJ file. More...
 
class  PNGImageValueInterpreter
 
class  PovExporter
 Class for exporting a simulation into AGX .pov format. More...
 
class  ResourceManager
 

Typedefs

typedef agx::ref_ptr< ArgumentParserArgumentParserRef
 
typedef float(* GetValueFunction) (float val)
 
typedef agx::observer_ptr< const ImageImageConstObserver
 
typedef agx::ref_ptr< const ImageImageConstRef
 
typedef agx::observer_ptr< ImageImageObserver
 
typedef agx::ref_ptr< ImageReaderPNGImageReaderPNGRef
 
typedef agx::ref_ptr< ImageReaderImageReaderRef
 
typedef agx::ref_ptr< ImageImageRef
 
typedef agx::Event2< int, EventTypeInputEvent
 
typedef agx::observer_ptr< const KeyEventKeyEventConstObserver
 
typedef agx::ref_ptr< const KeyEventKeyEventConstRef
 
typedef agx::observer_ptr< KeyEventKeyEventObserver
 
typedef agx::ref_ptr< KeyEventKeyEventRef
 
typedef agx::observer_ptr< const MeshReaderMeshReaderConstObserver
 
typedef agx::ref_ptr< const MeshReaderMeshReaderConstRef
 
typedef agx::ref_ptr< MeshReaderOBJMeshReaderOBJRef
 
typedef agx::observer_ptr< MeshReaderMeshReaderObserver
 
typedef agx::ref_ptr< MeshReaderMeshReaderRef
 
typedef agx::Event3< MouseButton, EventType, agx::Vec2MouseEvent
 
typedef agx::ref_ptr< PNGImageValueInterpreterPNGImageValueInterpreterRef
 
typedef float(* ReadValue01Function) (agxIO::Image *image, size_t x, size_t y)
 
typedef agx::observer_ptr< const ResourceManagerResourceManagerConstObserver
 
typedef agx::ref_ptr< const ResourceManagerResourceManagerConstRef
 
typedef agx::observer_ptr< ResourceManagerResourceManagerObserver
 
typedef agx::ref_ptr< ResourceManagerResourceManagerRef
 

Enumerations

enum  EventType { EVENT_DOWN , EVENT_UP }
 
enum  FileType { FILETYPE_AGX , FILETYPE_AAGX , FILETYPE_POV }
 Specify the type of file. More...
 
enum  MouseButton {
  MOUSE_LEFT , MOUSE_RIGHT , MOUSE_MIDDLE , MOUSE_WHEELUP ,
  MOUSE_WHEELDOWN
}
 

Functions

template<>
bool AGXCORE_EXPORT ArgumentParser::assignStringContent< agx::String > (const std::string &key, agx::String &type)
 
template<>
bool AGXCORE_EXPORT ArgumentParser::assignStringContent< std::string > (const std::string &key, std::string &type)
 
AGXPHYSICS_EXPORT bool createCompressedArchive (const agx::String &archiveName, const agx::StringVector &files)
 Function which will create a zipped file of name archiveName containing the files listed in files.
 
float cubicValueFunction (float val)
 
AGXPHYSICS_EXPORT bool decompressArchive (const agx::String &archiveFile, const agx::String &directory)
 Function which will de-compress an archive to a target directory.
 
AGXCORE_EXPORT bool getRegisterValue (const char *key, agx::String &value)
 Get a string value from the registry written by the Installer.
 
float linearValueFunction (float val)
 
AGXCORE_EXPORT bool packZipFile (const agx::String &zipFilePath, const agx::StringVector &fileList, agx::UInt compression=6)
 
float quadraticValueFunction (float val)
 
AGXCORE_EXPORT char * readBinaryFile (size_t *size, const agx::String &filePath)
 Read the content of a file into a char array allocated by the function.
 
void AGXCORE_EXPORT readFile (agx::String &result, const agx::String &filePath)
 
AGXPHYSICS_EXPORT bool readFile (const agx::String &filename, agxSDK::Simulation *simulation, agxSDK::Assembly *parent=nullptr, agx::UInt selection=agxSDK::Simulation::READ_DEFAULT)
 Utility function for reading various files:
 
float readFourChannelMergedValue01 (agxIO::Image *image, size_t x, size_t y)
 
float readOneOrTwoChannelValue01 (agxIO::Image *image, size_t x, size_t y)
 
float readSingleChannelValue01 (agxIO::Image *image, size_t x, size_t y, size_t channel)
 
float readThreeChannelMergedValue01 (agxIO::Image *image, size_t x, size_t y)
 
void AGXCORE_EXPORT registerKeyboardCallback (int key, InputEvent::CallbackType *callback)
 
void AGXCORE_EXPORT registerMouseCallback (MouseEvent::CallbackType *callback)
 
void AGXCORE_EXPORT triggerKeyboardEvent (int key, EventType type)
 
void AGXCORE_EXPORT triggerMouseEvent (MouseButton button, EventType type, const agx::Vec2 &pos)
 
AGXCORE_EXPORT bool unpackZipFile (const agx::String &zipFilePath, const agx::String &targetDirectoryPath)
 
void AGXCORE_EXPORT unregisterMouseCallback (MouseEvent::CallbackType *callback)
 
AGXPHYSICS_EXPORT bool writeFile (const agx::String &filename, agxSDK::Simulation *simulation, agx::Vec3 from=agx::Vec3(), agx::Vec3 at=agx::Vec3(), agx::Vec3 up=agx::Vec3(), double fovy=0, double aspectRatio=0)
 Utility function for write a simulation into various files:
 
AGXPHYSICS_EXPORT bool writeFile (FileType type, std::ostream &outStream, agxSDK::Simulation *simulation, agx::Vec3 from=agx::Vec3(), agx::Vec3 at=agx::Vec3(), agx::Vec3 up=agx::Vec3(), double fovy=0, double aspectRatio=0)
 Utility function for write a simulation to a stream.
 
void writeSingleChannelValue01 (unsigned char val, agxIO::Image *image, size_t x, size_t y, size_t channel)
 

Detailed Description

The agxIO namespace contains classes for reading, writing and finding files.

Typedef Documentation

◆ ArgumentParserRef

◆ GetValueFunction

typedef float(* agxIO::GetValueFunction) (float val)

Definition at line 25 of file ImageValueInterpreter.h.

◆ ImageConstObserver

Definition at line 28 of file Image.h.

◆ ImageConstRef

Definition at line 28 of file Image.h.

◆ ImageObserver

Definition at line 28 of file Image.h.

◆ ImageReaderPNGRef

◆ ImageReaderRef

Definition at line 41 of file ImageReader.h.

◆ ImageRef

Definition at line 28 of file Image.h.

◆ InputEvent

Definition at line 44 of file Events.h.

◆ KeyEventConstObserver

Definition at line 27 of file KeyEvent.h.

◆ KeyEventConstRef

Definition at line 27 of file KeyEvent.h.

◆ KeyEventObserver

Definition at line 27 of file KeyEvent.h.

◆ KeyEventRef

Definition at line 27 of file KeyEvent.h.

◆ MeshReaderConstObserver

Definition at line 77 of file MeshReader.h.

◆ MeshReaderConstRef

Definition at line 77 of file MeshReader.h.

◆ MeshReaderOBJRef

◆ MeshReaderObserver

Definition at line 77 of file MeshReader.h.

◆ MeshReaderRef

Definition at line 77 of file MeshReader.h.

◆ MouseEvent

Definition at line 45 of file Events.h.

◆ PNGImageValueInterpreterRef

◆ ReadValue01Function

typedef float(* agxIO::ReadValue01Function) (agxIO::Image *image, size_t x, size_t y)

Definition at line 26 of file ImageValueInterpreter.h.

◆ ResourceManagerConstObserver

◆ ResourceManagerConstRef

Definition at line 27 of file ResourceManager.h.

◆ ResourceManagerObserver

◆ ResourceManagerRef

Enumeration Type Documentation

◆ EventType

Enumerator
EVENT_DOWN 
EVENT_UP 

Definition at line 37 of file Events.h.

◆ FileType

Specify the type of file.

Enumerator
FILETYPE_AGX 
FILETYPE_AAGX 
FILETYPE_POV 

Definition at line 55 of file agxIO/ReaderWriter.h.

◆ MouseButton

Enumerator
MOUSE_LEFT 
MOUSE_RIGHT 
MOUSE_MIDDLE 
MOUSE_WHEELUP 
MOUSE_WHEELDOWN 

Definition at line 28 of file Events.h.

Function Documentation

◆ ArgumentParser::assignStringContent< agx::String >()

template<>
bool AGXCORE_EXPORT agxIO::ArgumentParser::assignStringContent< agx::String > ( const std::string &  key,
agx::String type 
)

◆ ArgumentParser::assignStringContent< std::string >()

template<>
bool AGXCORE_EXPORT agxIO::ArgumentParser::assignStringContent< std::string > ( const std::string &  key,
std::string &  type 
)

◆ createCompressedArchive()

AGXPHYSICS_EXPORT bool agxIO::createCompressedArchive ( const agx::String archiveName,
const agx::StringVector files 
)

Function which will create a zipped file of name archiveName containing the files listed in files.

Valid file extensions are:

  • .agxz (archive will contain a compressed .agx file)
  • .aagxz (archive will contain a compressed .aagx file)
  • .agxPyz (archive will contain a .agxPy file of the same name as the archive + any other files/directories with files required for the .agxPy file to run)
  • .mpyz (archive will contain a .agx file of the same name as the archive + one or more .mpy files)
Parameters
archiveName- Name of created archive
files- List of file to be compressed into archive
Returns
true if the archive is successfully created and the list of files contains the above listed ones.

◆ cubicValueFunction()

float agxIO::cubicValueFunction ( float  val)
inline

Definition at line 38 of file ImageValueInterpreter.h.

◆ decompressArchive()

AGXPHYSICS_EXPORT bool agxIO::decompressArchive ( const agx::String archiveFile,
const agx::String directory 
)

Function which will de-compress an archive to a target directory.

  • .agxz (archive need to contain a compressed .agx file)
  • .aagxz (archive need to contain a compressed .aagx file)
  • .agxPyz (archive need to contain a .agxPy file of the same name as the archive + any other files/directories with files required for the .agxPy file to run)
  • .mpyz (archive need to contain a .agx file of the same name as the archive + one or more .mpy files)
Parameters
archiveFile- Name of zipped archive
directory- Path to where files are unzipped.
Returns
true if files are successfully unzipped and contains the files as listed above

◆ getRegisterValue()

AGXCORE_EXPORT bool agxIO::getRegisterValue ( const char *  key,
agx::String value 
)

Get a string value from the registry written by the Installer.

Parameters
key- Name of the key
value- At success, the value will contain the string content of the key.
Returns
true if the key exist and is of type string and we have read access to it.

◆ linearValueFunction()

float agxIO::linearValueFunction ( float  val)
inline

Definition at line 28 of file ImageValueInterpreter.h.

◆ packZipFile()

AGXCORE_EXPORT bool agxIO::packZipFile ( const agx::String zipFilePath,
const agx::StringVector fileList,
agx::UInt  compression = 6 
)

◆ quadraticValueFunction()

float agxIO::quadraticValueFunction ( float  val)
inline

Definition at line 33 of file ImageValueInterpreter.h.

◆ readBinaryFile()

AGXCORE_EXPORT char * agxIO::readBinaryFile ( size_t *  size,
const agx::String filePath 
)

Read the content of a file into a char array allocated by the function.

Ownership of the array is passed to the caller, who then becomes responsible for calling 'delete []' on it.

◆ readFile() [1/2]

void AGXCORE_EXPORT agxIO::readFile ( agx::String result,
const agx::String filePath 
)

◆ readFile() [2/2]

AGXPHYSICS_EXPORT bool agxIO::readFile ( const agx::String filename,
agxSDK::Simulation simulation,
agxSDK::Assembly parent = nullptr,
agx::UInt  selection = agxSDK::Simulation::READ_DEFAULT 
)

Utility function for reading various files:

  • .agx/.aagx (serialization of simulations)

The file will be searched for using AGX_ENVIRONMENT().getFilePath(agxIO::Environment::RESOURCE_PATH).find() which means that it will use the AGX_FILE_PATH environment variable and path's added to the RESOURCE_PATH.

The data will be added to the simulation given as an argument

Parameters
filename- Filename to be opened and read
simulation- The simulation where the content of the data will be added
parent- If specified (!= nullptr) all objects will be added to this parent
selection- Selection of things to read from file. See agxSDK::Simulation::ReadSelectionMask. Only for .agx or .aagx.
Returns
true if reading was successful.

◆ readFourChannelMergedValue01()

float agxIO::readFourChannelMergedValue01 ( agxIO::Image image,
size_t  x,
size_t  y 
)
inline

Definition at line 58 of file ImageValueInterpreter.h.

References agxIO::Image::getData(), and agxIO::Image::getWidth().

◆ readOneOrTwoChannelValue01()

float agxIO::readOneOrTwoChannelValue01 ( agxIO::Image image,
size_t  x,
size_t  y 
)
inline

◆ readSingleChannelValue01()

float agxIO::readSingleChannelValue01 ( agxIO::Image image,
size_t  x,
size_t  y,
size_t  channel 
)
inline

◆ readThreeChannelMergedValue01()

float agxIO::readThreeChannelMergedValue01 ( agxIO::Image image,
size_t  x,
size_t  y 
)
inline

Definition at line 50 of file ImageValueInterpreter.h.

References agxIO::Image::getData(), and agxIO::Image::getWidth().

◆ registerKeyboardCallback()

void AGXCORE_EXPORT agxIO::registerKeyboardCallback ( int  key,
InputEvent::CallbackType callback 
)

◆ registerMouseCallback()

void AGXCORE_EXPORT agxIO::registerMouseCallback ( MouseEvent::CallbackType callback)

◆ triggerKeyboardEvent()

void AGXCORE_EXPORT agxIO::triggerKeyboardEvent ( int  key,
EventType  type 
)

◆ triggerMouseEvent()

void AGXCORE_EXPORT agxIO::triggerMouseEvent ( MouseButton  button,
EventType  type,
const agx::Vec2 pos 
)

◆ unpackZipFile()

AGXCORE_EXPORT bool agxIO::unpackZipFile ( const agx::String zipFilePath,
const agx::String targetDirectoryPath 
)

◆ unregisterMouseCallback()

void AGXCORE_EXPORT agxIO::unregisterMouseCallback ( MouseEvent::CallbackType callback)

◆ writeFile() [1/2]

AGXPHYSICS_EXPORT bool agxIO::writeFile ( const agx::String filename,
agxSDK::Simulation simulation,
agx::Vec3  from = agx::Vec3(),
agx::Vec3  at = agx::Vec3(),
agx::Vec3  up = agx::Vec3(),
double  fovy = 0,
double  aspectRatio = 0 
)

Utility function for write a simulation into various files:

  • .agx/.aagx (serialization of simulations)
  • .pov (Povray format)
Parameters
filename- Filename that will contain the simulation
simulation- The simulation containing the objects to be written to file
from- Camera position (only for .pov format)
at- Camera looking at point (only for .pov format)
up- Camera up direction (only for .pov format)
fovy- Field of view (only for .pov format)
aspectRatioratio for the window size (only for .pov format)
Returns
true if writing was successful.

◆ writeFile() [2/2]

AGXPHYSICS_EXPORT bool agxIO::writeFile ( FileType  type,
std::ostream &  outStream,
agxSDK::Simulation simulation,
agx::Vec3  from = agx::Vec3(),
agx::Vec3  at = agx::Vec3(),
agx::Vec3  up = agx::Vec3(),
double  fovy = 0,
double  aspectRatio = 0 
)

Utility function for write a simulation to a stream.

Parameters
type- Specifies in what format, the simulation will be written to the stream
outStream- Stream that will contain the simulation
simulation- The simulation containing the objects to be written to file
from- Camera position (only for .pov format)
at- Camera looking at point (only for .pov format)
up- Camera up direction (only for .pov format)
fovy- Field of view (only for .pov format)
aspectRatioratio for the window size (only for .pov format)
Returns
true if writing was successful.

◆ writeSingleChannelValue01()

void agxIO::writeSingleChannelValue01 ( unsigned char  val,
agxIO::Image image,
size_t  x,
size_t  y,
size_t  channel 
)
inline