Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# Platform/Aperios1.3.2/SoundDataSender.h

Go to the documentation of this file.

    00001 /**
    00002  * @file Platform/Aperios1.3.2/SoundDataSender.h
    00003  * This file contains a sender for sound data.
    00004  */
    00005 #ifndef __SOUNDDATASENDER_H__
    00006 #define __SOUNDDATASENDER_H__
    00007
    00008 #ifndef __ProcessFramework_h__
    00009 #error Never include this file directly. Include ProcessFramework.h instead.
    00010 #endif
    00011
    00012 #include "Platform/ProcessFramework.h"
    00013 #include "Representations/Sound/SoundData.h"
    00014 #include <OPENR/OPENRAPI.h>
    00015
    00016 /**
    00017  * This class implements a sender for sound data.
    00018  */
    00019 class SoundDataSender : public SenderBase<SoundData>
    00020 {
    00021   private:
    00022     MemoryRegionID memID[2]; /**< The memory regions of the two package instances. */
    00023     OSoundVectorData* soundVec[2]; /**< Pointers to the data in the packages. */
    00024     RCRegion* package[2]; /**< The two instances of the packages. */
    00025     int index; /**< The index of the next package. */
    00026
    00027     /**
    00028      * The function fills a package with data.
    00029      * @param i The index of the package (0 or 1).
    00030      */
    00031     void prepare(int i);
    00032
    00033   protected:
    00034     /**
    00035      * The function prepares a package.
    00036      */
    00037     virtual void preparePackage();
    00038
    00039     /**
    00040      * The functions sets a package for a receiver.
    00041      * @param receiver The receive the package will be sent to.
    00042      */
    00043     virtual void setPackage(const ObserverID& receiver);
    00044
    00045     /**
    00046      * The function frees the package.
    00047      */
    00048     virtual void freePackage();
    00049
    00050   public:
    00051     /**
    00052      * The constructor.
    00053      * @param process The process this sender is associated with.
    00054      * @param blocking Decides whether this sender blocks the execution of the next frame
    00055      *                 until all connected receivers have requested a new package.
    00056      */
    00057     SoundDataSender(PlatformProcess* process,bool blocking);
    00058
    00059     /**
    00060      * Destructor.
    00061      */
    00062     ~SoundDataSender();
    00063 };
    00064
    00065 /**
    00066  * The macro declares a sender for sound data.
    00067  * It must be used inside a declaration of a process, after the macro DEBUGGING.
    00068  */
    00069 #define SENDER_SOUNDDATA \
    00070   SoundDataSender theSoundDataSender
    00071
    00072 /**
    00073  * The macro instantiates a sender for sound data.
    00074  * @param blocking Decides whether this sender blocks the execution of the next frame
    00075  *                 until all connected receivers have requested a new package.
    00076  */
    00077 #define INIT_SENDER_SOUNDDATA(blocking) \
    00078   theSoundDataSender(this,blocking)
    00079
    00080 #endif