Panda3D
Loading...
Searching...
No Matches
fileReference.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file fileReference.h
10 * @author drose
11 * @date 2011-06-23
12 */
13
14#ifndef FILEREFERENCE_H
15#define FILEREFERENCE_H
16
17#include "pandabase.h"
18
19#include "typedReferenceCount.h"
20#include "filename.h"
21
22/**
23 * Keeps a reference-counted pointer to a file on disk. As long as the
24 * FileReference is held, someone presumably has a use for this file.
25 */
26class EXPCL_PANDA_EXPRESS FileReference : public TypedReferenceCount {
27PUBLISHED:
28 INLINE FileReference(const Filename &filename);
29 INLINE const Filename &get_filename() const;
30
31protected:
32 Filename _filename;
33
34public:
35 static TypeHandle get_class_type() {
36 return _type_handle;
37 }
38 static void init_type() {
39 TypedReferenceCount::init_type();
40 register_type(_type_handle, "FileReference",
41 TypedReferenceCount::get_class_type());
42 }
43 virtual TypeHandle get_type() const {
44 return get_class_type();
45 }
46 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
47
48private:
49 static TypeHandle _type_handle;
50};
51
52#include "fileReference.I"
53
54#endif
Keeps a reference-counted pointer to a file on disk.
The name of a file, such as a texture file or an Egg file.
Definition filename.h:44
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.