30 #ifndef __H3DIMAGELOADERNODE_H__
31 #define __H3DIMAGELOADERNODE_H__
53 typedef bool ( *SupportsFileFunc)(
const string &url );
56 typedef bool ( *SupportsStreamFunc)( istream &is );
66 CreateNodeFunc _create,
67 SupportsFileFunc _supports,
68 SupportsStreamFunc _supports_stream= NULL ):
70 create_func( _create ),
71 supports_func( _supports ),
72 supports_stream_func ( _supports_stream ) {
74 if( !H3DImageLoaderNode::initialized ) {
75 H3DImageLoaderNode::registered_file_readers.reset(
76 new list< FileReaderRegistration > );
83 CreateNodeFunc create_func;
84 SupportsFileFunc supports_func;
85 SupportsStreamFunc supports_stream_func;
88 friend struct FileReaderRegistration;
93 type_name =
"H3DImageLoaderNode";
115 return "imageLoader";
137 CreateNodeFunc create,
138 SupportsFileFunc supports,
139 SupportsStreamFunc supports_stream= NULL ) {
146 registered_file_readers->push_back( fr );
156 class local_auto_ptr{
160 typedef T element_type;
163 explicit local_auto_ptr (T* ptr = 0) {
171 local_auto_ptr (local_auto_ptr& rhs)
throw() : ap(rhs.release()) { }
174 local_auto_ptr (local_auto_ptr<Y>& rhs)
throw() : ap(rhs.release()) { }
178 local_auto_ptr& operator= (local_auto_ptr& rhs)
throw(){
180 reset(rhs.release());
185 local_auto_ptr& operator= (local_auto_ptr<Y>& rhs)
throw(){
187 reset(rhs.release());
193 ~local_auto_ptr() throw(){
198 T* get()
const throw(){
204 T* operator->()
const throw(){
209 T* release() throw(){
218 void reset (T* ptr=0) throw(){
229 static local_auto_ptr< list< FileReaderRegistration > > registered_file_readers;
231 static bool initialized;
H3DImageLoaderNode is a virtual base class for classes that read an image file format such as PNG or ...
Definition: H3DImageLoaderNode.h:48
virtual Image * loadImage(const string &url)=0
Pure virtual function to load an Image from a url.
static void registerFileReader(const FileReaderRegistration &fr)
Register a file reader that can then be returned by getSupportedFileReader().
Definition: H3DImageLoaderNode.h:145
H3DImageLoaderNode()
Constructor.
Definition: H3DImageLoaderNode.h:92
virtual Image * loadImage(istream &)
Load an image from an istream.
Definition: H3DImageLoaderNode.h:109
static void registerFileReader(const string &name, CreateNodeFunc create, SupportsFileFunc supports, SupportsStreamFunc supports_stream=NULL)
Register a file reader that can then be returned by getSupportedFileReader().
Definition: H3DImageLoaderNode.h:136
virtual string defaultXMLContainerField()
Returns the default xml containerField attribute value.
Definition: H3DImageLoaderNode.h:114
Node is the base class for all classes that can be part of the H3D scene-graph.
Definition: Node.h:46
DualQuaternion operator*(const DualQuaternion &q1, const DualQuaternion &q2)
H3D API namespace.
Definition: Anchor.h:38
Class used to register a class to the registered file readers.
Definition: H3DImageLoaderNode.h:62
FileReaderRegistration(const string &_name, CreateNodeFunc _create, SupportsFileFunc _supports, SupportsStreamFunc _supports_stream=NULL)
Constructor.
Definition: H3DImageLoaderNode.h:65