- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Utils/Containers/ObjectQueue.cpp

    00001
    00002 //
    00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00009 // Organization:        Model-based Embedded and Robotic Systems Group
    00010 //                                      Massachusetts Institute of Technology
    00011 //
    00013
    00014 #include "ObjectQueue.h"
    00015 #include <stdio.h>
    00016
    00018
    00019 using namespace Mers::Utils::Containers;
    00020 using std::ostream;
    00021
    00023 // Construction/Destruction
    00025
    00026 ObjectQueue::ObjectQueue(bool myOwnershipStatus, int myMaxQueueSize)
    00027 : DynamicQueue(DynamicArray::oObjectQueue, myOwnershipStatus, myMaxQueueSize)
    00028 {
    00029
    00030 }
    00031
    00033
    00034 ObjectQueue::~ObjectQueue()
    00035 {
    00036
    00037 }
    00038
    00040
    00041 int ObjectQueue::enqueue(BaseModelObject * element)
    00042 {
    00043         return DynamicQueue::enqueue((void *)element);
    00044 }
    00045
    00047
    00048 int ObjectQueue::dequeue(BaseModelObject * &element)
    00049 {
    00050         return DynamicQueue::dequeue((void * &)element);
    00051 }
    00052
    00054
    00055 int ObjectQueue::peekQueue(BaseModelObject * &element)
    00056 {
    00057         return DynamicQueue::peekQueue((void * &)element);
    00058 }
    00059
    00061
    00062 #ifndef EMBEDDED
    00063
    00064 void ObjectQueue::printElement(ostream &out, void const * element) const
    00065 {
    00066         ((BaseModelObject const *) element)->print(out);
    00067 }
    00068
    00069 #endif
    00070
    00072
    00073 void ObjectQueue::deleteElement(void * element) const
    00074 {
    00075         delete (BaseModelObject *) element;
    00076 }
    00077
    00079
    00080 void * ObjectQueue::newElement(void const * element) const
    00081 {
    00082         fprintf(stderr, "Error, Generic Base Model Objects cannot be copied: %s\n",
    00083                 BaseModelObject::objectTypeToString(((BaseModelObject const *)element)->getObjectType()));
    00084         return NULL;
    00085 }
    00086