Inherits GenericContainer.
Public Methods | |
| virtual | ~ContainerBase () |
| void | close () |
| Close the container and release all memory. | |
| void | satt (const char *name, const char *value) |
| Set an attribute. | |
| int | get (ObjectType &buf, int count) |
| Get some objects from the container. | |
| bool | eof () |
| Report if at end of container. | |
| int | put (ObjectType &buf, int count) |
| Put some objects in the container. | |
| bool | operator! () const |
| Test whether this container is valid. | |
| bool | isValid () |
| Test whether this container is valid. | |
| operator GaiaFS::Container * () const | |
| Convert to native container. | |
| int | size () |
| Tell the number of data objects in the container. | |
| void | seek (unsigned long position) |
| Set the current object index pointer. | |
| unsigned long | tell () |
| Tell what object index currently pointing to. | |
Protected Methods | |
| ContainerBase () | |
| ContainerBase (const char *name, const char *kind, int mode, int index) | |
| Open a container of the specified type. | |
| ContainerBase (GenericContainer *container, const char *kind) | |
| Adapt a container interface to a new interface. | |
| ContainerBase (GaiaFS::Container *container) | |
| Create a new container wrapper for a remote reference. | |
| void | open (const char *name, const char *kind, int mode, int index=0) |
| ContainerBase (ContainerBase &c) | |
| ContainerBase & | operator= (ContainerBase &c) |
Protected Attributes | |
| ContainerType * | _container |
This is the base class is used by all containers to manipulate the objects in a container. Please refer to the particular concrete container for the type of objects that they contain. Use the methods described to below to access the data objects. The ObjectType defined by the container type you are using becomes the template argument. See the Examples directory for usage.
Container Type (Object Type)
Example:
int main(int argc, char **argv)
{
Gaia::init();
try {
int count;
Dirents dirents;
DirectoryContainer c("/temp", GaiaFS::Read);
while (!c.eof()) {
count = c.get(dirents, 32);
for (int i = 0; i < count; i++) {
printf("%-12d%-12d%-8ds"
dirents[i].mtime,
dirents[i].size,
dirents[i].index,
dirents[i].name
);
}
}
c.close();
} catch (GaiaFS::IOError) {
cerr << "network error" << endl;
} catch (GaiaFS::NotReachable) {
cerr << "server hosting data not reachable" << endl;
} catch (...) {
cerr << "unknown error" << endl;
}
Gaia::fini();
return 0;
}
|
||||||||||||||||||||||||
|
Open a container of the specified type.
|
|
||||||||||||||||
|
Adapt a container interface to a new interface.
ByteContainer b(...); GIFContainer g(&b);
|
|
||||||||||
|
Create a new container wrapper for a remote reference.
|
|
|||||||||
|
Close the container and release all memory.
|
|
|||||||||
|
Report if at end of container.
|
|
||||||||||||||||
|
Get some objects from the container.
|
|
|||||||||
|
Test whether this container is valid.
|
|
|||||||||
|
Convert to native container. This can be used to pass it to another object and then wrap in the new object.
|
|
|||||||||
|
Test whether this container is valid.
|
|
||||||||||||||||
|
Put some objects in the container.
|
|
||||||||||||||||
|
Set an attribute. If the name already exists, overwrite the old value. If the name does not exist, create a new entry. Expand the length of the seqence if there is not enough room for a new entry.
|
|
||||||||||
|
Set the current object index pointer.
|
|
|||||||||
|
Tell the number of data objects in the container.
|
|
|||||||||
|
Tell what object index currently pointing to.
|
1.2.16