![]() |
Max OS 0.3
|
Represents a generic resource that can be opened, closed, read from and written to. More...
#include <resource.h>
Public Member Functions | |
| Resource (const string &name, size_t flags, resource_type_t type) | |
| Constructs a new Resource object. | |
| string | name () |
| Gets the name of this resource. | |
| resource_type_t | type () |
| Gets the type of this resource. | |
| virtual void | open (size_t flags) |
| Opens the resource. | |
| virtual void | close (size_t flags) |
| Closes the resource. | |
| virtual int | read (void *buffer, size_t size, size_t flags) |
| read a certain amount of bytes from a resource | |
| virtual int | write (const void *buffer, size_t size, size_t flags) |
| write a certain amount of bytes to a resource | |
Represents a generic resource that can be opened, closed, read from and written to.
Definition at line 29 of file resource.h.
| Resource::Resource | ( | const string & | name, |
| size_t | flags, | ||
| resource_type_t | type | ||
| ) |
Constructs a new Resource object.
| name | The name of the resource |
| flags | The flags for the resource (unused by default but resource type specific) |
| type | The type of the resource |
Definition at line 21 of file resource.cpp.
|
virtual |
Closes the resource.
| flags | Optional flags to pass (unused by default but resource type specific) |
Reimplemented in MaxOS::processes::SharedMemory.
Definition at line 45 of file resource.cpp.
Referenced by MaxOS::processes::BaseResourceRegistry::close_resource().
| string Resource::name | ( | ) |
Gets the name of this resource.
Definition at line 79 of file resource.cpp.
Referenced by MaxOS::processes::BaseResourceRegistry::close_resource(), MaxOS::processes::BaseResourceRegistry::register_resource(), MaxOS::filesystem::FileResource::write(), and MaxOS::filesystem::DirectoryResource::write().
|
virtual |
Opens the resource.
| flags | Optional flags to pass (unused by default but resource type specific) |
Reimplemented in MaxOS::processes::SharedMemory.
Definition at line 35 of file resource.cpp.
|
virtual |
read a certain amount of bytes from a resource
| buffer | The buffer to read into |
| size | How many bytes to read |
| flags | Optional flags to pass (unused by default but resource type specific) |
Reimplemented in MaxOS::filesystem::FileResource, MaxOS::filesystem::DirectoryResource, MaxOS::processes::SharedMemory, and MaxOS::processes::SharedMessageEndpoint.
Definition at line 57 of file resource.cpp.
| resource_type_t Resource::type | ( | ) |
Gets the type of this resource.
Definition at line 88 of file resource.cpp.
Referenced by MaxOS::processes::ResourceManager::close_resource().
|
virtual |
write a certain amount of bytes to a resource
| buffer | The buffer to read from |
| size | How many bytes to write |
| flags | Optional flags to pass (unused by default but resource type specific) |
Reimplemented in MaxOS::filesystem::FileResource, MaxOS::filesystem::DirectoryResource, and MaxOS::processes::SharedMessageEndpoint.
Definition at line 69 of file resource.cpp.