KrisLibrary  1.0.0
Public Types | Public Member Functions | Public Attributes | List of all members
BasicArrayResource< T > Class Template Reference

A basic array data type. More...

#include <ResourceLibrary.h>

Inheritance diagram for BasicArrayResource< T >:
CompoundResourceBase ResourceBase

Public Types

typedef BasicResource< T > BaseType
 

Public Member Functions

 BasicArrayResource (const std::vector< T > &val)
 
 BasicArrayResource (const std::vector< T > &val, const std::string &name)
 
 BasicArrayResource (const std::vector< T > &val, const std::string &name, const std::string &fileName)
 
virtual bool Load (std::istream &in)
 
virtual bool Save (std::ostream &out)
 
virtual bool Load (const std::string &fn)
 
virtual bool Load ()
 
virtual bool Save (const std::string &fn)
 
virtual bool Save ()
 
virtual bool Load (AnyCollection &c)
 
virtual bool Save (AnyCollection &c)
 
virtual const char * Type () const
 
virtual ResourceBaseMake ()
 
virtual ResourceBaseCopy ()
 
virtual std::vector< std::string > SubTypes () const
 Returns a list of subtypes that will be produced in Unpack.
 
virtual bool Extract (const char *subtype, std::vector< ResourcePtr > &subobjects)
 
virtual bool Pack (std::vector< ResourcePtr > &subobjects, std::string *errorMessage=NULL)
 
virtual bool Unpack (std::vector< ResourcePtr > &subobjects, bool *incomplete=NULL)
 
template<>
bool Load (std::istream &in)
 
template<>
bool Save (std::ostream &out)
 
- Public Member Functions inherited from CompoundResourceBase
 CompoundResourceBase (const std::string &name)
 
 CompoundResourceBase (const std::string &name, const std::string &fileName)
 
virtual std::vector< std::string > CastTypes () const
 Returns a list of subtypes that can be used in Cast.
 
virtual std::vector< std::string > ExtractTypes () const
 Returns a list of subtypes that can be used in Extract.
 
virtual ResourcePtr Cast (const char *type)
 
- Public Member Functions inherited from ResourceBase
 ResourceBase (const std::string &name)
 
 ResourceBase (const std::string &name, const std::string &fn)
 
virtual bool Load (TiXmlElement *in)
 
virtual bool Save (TiXmlElement *out)
 

Public Attributes

std::vector< T > data
 
- Public Attributes inherited from ResourceBase
std::string name
 
std::string fileName
 

Detailed Description

template<class T>
class BasicArrayResource< T >

A basic array data type.

Assumes the data type has std::ostream << and std::istream >> overloads.

Member Function Documentation

template<class T>
virtual ResourceBase* BasicArrayResource< T >::Copy ( )
inlinevirtual

Make a ResourceBase that copies all the contents of this. (Copying the name and fileName are optional)

Reimplemented from ResourceBase.

template<class T>
virtual bool BasicArrayResource< T >::Extract ( const char *  subtype,
std::vector< ResourcePtr > &  subobjects 
)
inlinevirtual

Extracts all items of the given subtype. Default uses Unpack to find objects of the right type.

Reimplemented from CompoundResourceBase.

template<class T>
virtual ResourceBase* BasicArrayResource< T >::Make ( )
inlinevirtual

Make a ResourceBase of the same dynamic type as this. ResourceBase instances are their own factories.

Reimplemented from ResourceBase.

template<class T>
virtual bool BasicArrayResource< T >::Pack ( std::vector< ResourcePtr > &  subobjects,
std::string *  errorMessage = NULL 
)
inlinevirtual

Creates the object of out of the given resources, returning true if successful. If unsuccessful, the error message may be set to an informative description of the error.

Reimplemented from CompoundResourceBase.

template<class T>
virtual const char* BasicArrayResource< T >::Type ( ) const
inlinevirtual

A unique type string used for type indexing and xml output, only alphanumeric characters allowed.

Reimplemented from ResourceBase.

template<class T>
virtual bool BasicArrayResource< T >::Unpack ( std::vector< ResourcePtr > &  subobjects,
bool *  incomplete = NULL 
)
inlinevirtual

Creates a list of sub-objects that describe the given resource. If the decomposition succeeded, returns true If the decomposition succeeded but is incomplete, the flag incomplete is set to true (if non-null). Here "incomplete" means that calling Pack on the return array may NOT produce an exact copy of r.

Reimplemented from CompoundResourceBase.


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