OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 19 matching lines...) Expand all Loading... |
30 */ | 30 */ |
31 | 31 |
32 | 32 |
33 // This file contains the definition for resource classes and the resource map. | 33 // This file contains the definition for resource classes and the resource map. |
34 | 34 |
35 #ifndef O3D_COMMAND_BUFFER_SERVICE_CROSS_RESOURCE_H_ | 35 #ifndef O3D_COMMAND_BUFFER_SERVICE_CROSS_RESOURCE_H_ |
36 #define O3D_COMMAND_BUFFER_SERVICE_CROSS_RESOURCE_H_ | 36 #define O3D_COMMAND_BUFFER_SERVICE_CROSS_RESOURCE_H_ |
37 | 37 |
38 #include <vector> | 38 #include <vector> |
39 #include "base/scoped_ptr.h" | 39 #include "base/scoped_ptr.h" |
40 #include "core/cross/types.h" | |
41 #include "command_buffer/common/cross/resource.h" | 40 #include "command_buffer/common/cross/resource.h" |
42 | 41 |
43 namespace o3d { | 42 namespace o3d { |
44 namespace command_buffer { | 43 namespace command_buffer { |
45 | 44 |
46 // Base class for resources, just providing a common Destroy function. | 45 // Base class for resources, just providing a common Destroy function. |
47 class Resource { | 46 class Resource { |
48 public: | 47 public: |
49 Resource() {} | 48 Resource() {} |
50 virtual ~Resource() {} | 49 virtual ~Resource() {} |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // Destroys a resource. | 251 // Destroys a resource. |
253 bool Destroy(ResourceId id) { | 252 bool Destroy(ResourceId id) { |
254 return container_.Destroy(id); | 253 return container_.Destroy(id); |
255 } | 254 } |
256 // Destroy all resources. | 255 // Destroy all resources. |
257 void DestroyAllResources() { | 256 void DestroyAllResources() { |
258 return container_.DestroyAllResources(); | 257 return container_.DestroyAllResources(); |
259 } | 258 } |
260 // Gets a resource by ID. | 259 // Gets a resource by ID. |
261 T *Get(ResourceId id) { | 260 T *Get(ResourceId id) { |
262 return down_cast<T*>(container_.Get(id)); | 261 return static_cast<T*>(container_.Get(id)); |
263 } | 262 } |
264 private: | 263 private: |
265 ResourceMapBase container_; | 264 ResourceMapBase container_; |
266 }; | 265 }; |
267 | 266 |
268 } // namespace command_buffer | 267 } // namespace command_buffer |
269 } // namespace o3d | 268 } // namespace o3d |
270 | 269 |
271 #endif // O3D_COMMAND_BUFFER_SERVICE_CROSS_RESOURCE_H_ | 270 #endif // O3D_COMMAND_BUFFER_SERVICE_CROSS_RESOURCE_H_ |
OLD | NEW |