1 /*
2 * Copyright 2006 Sony Computer Entertainment Inc.
3 *
4 * Licensed under the MIT Open Source License, for details please see license.txt or the website
5 * http://www.opensource.org/licenses/mit-license.php
6 *
7 */
8 
9 #ifndef __DAE_RAWRESOLVER_H__
10 #define __DAE_RAWRESOLVER_H__
11 
12 #include <string>
13 #include <map>
14 #include <dae/daeURI.h>
15 class DAE;
16 
17 /**
18  * The @c daeRawResolver class derives from @c daeURIResolver and implements
19  * the .raw backend resolver for raw binary data.
20  */
21 class DLLSPEC daeRawResolver : public daeURIResolver
22 {
23 public:
24 	/**
25 	 * Constructor.
26 	 */
27 	daeRawResolver(DAE& dae);
28 	/**
29 	 * Destructor.
30 	 */
31 	~daeRawResolver();
32 
33 public: // Abstract Interface
34 	virtual daeElement* resolveElement(const daeURI& uri);
35 	virtual daeString getName();
36 };
37 
38 // A simple class to make speed up the process of resolving a .raw URI.
39 // The result of the resolve is cached for future use.
40 // This is meant for DOM internal use only.
41 class DLLSPEC daeRawRefCache {
42 public:
daeRawRefCache()43 	daeRawRefCache() { lookupTable = new std::map<std::string, daeElement*>(); }
~daeRawRefCache()44 	~daeRawRefCache() { delete lookupTable; }
45 
46 	daeElement* lookup(const daeURI& uri);
47 	void add(const daeURI& uri, daeElement* elt);
48 	void remove(const daeURI& uri);
49 	void clear();
50 
51 private:
52 	std::map<std::string, daeElement*> * lookupTable;
53 };
54 
55 #endif
56