15 #include "pnmFileTypeSGI.h" 19 #include "config_pnmimagetypes.h" 22 #include "pnmFileTypeRegistry.h" 23 #include "bamReader.h" 25 static const char *
const extensions_sgi[] = {
28 static const int num_extensions_sgi =
sizeof(extensions_sgi) /
sizeof(
const char *);
46 string PNMFileTypeSGI::
58 get_num_extensions()
const {
59 return num_extensions_sgi;
69 string PNMFileTypeSGI::
70 get_extension(
int n)
const {
71 nassertr(n >= 0 && n < num_extensions_sgi,
string());
72 return extensions_sgi[n];
82 string PNMFileTypeSGI::
83 get_suggested_extension()
const {
94 has_magic_number()
const {
105 bool PNMFileTypeSGI::
106 matches_magic_number(
const string &magic_number)
const {
107 nassertr(magic_number.size() >= 2,
false);
109 ((
unsigned char)magic_number[0] << 8) |
110 ((
unsigned char)magic_number[1]);
111 return (mn == SGI_MAGIC);
122 make_reader(istream *file,
bool owns_file,
const string &magic_number) {
124 return new Reader(
this, file, owns_file, magic_number);
135 make_writer(ostream *file,
bool owns_file) {
137 return new Writer(
this, file, owns_file);
147 void PNMFileTypeSGI::
148 register_with_read_factory() {
150 register_factory(get_class_type(), make_PNMFileTypeSGI);
170 #endif // HAVE_SGI_RGB Base class for objects that can be written to and read from Bam files.
static PNMFileTypeRegistry * get_global_ptr()
Returns a pointer to the global PNMFileTypeRegistry object.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
PNMFileType * get_type_by_handle(TypeHandle handle) const
Returns the PNMFileType instance stored in the registry for the given TypeHandle, e...
This is an abstract base class that defines the interface for reading image files of various types...
This is an abstract base class that defines the interface for writing image files of various types...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
TypeHandle is the identifier used to differentiate C++ class types.