PetaVision  Alpha
BaseDelivery.hpp
1 /*
2  * BaseDelivery.hpp
3  *
4  * Created on: Nov 17, 2017
5  * Author: Pete Schultz
6  */
7 
8 #ifndef BASEDELIVERY_HPP_
9 #define BASEDELIVERY_HPP_
10 
11 #include "columns/BaseObject.hpp"
12 #include "components/ConnectionData.hpp"
13 #include "layers/HyPerLayer.hpp"
14 
15 namespace PV {
16 
17 class BaseDelivery : public BaseObject {
18  protected:
30  virtual void ioParam_channelCode(enum ParamsIOFlag ioFlag);
31 
37  virtual void ioParam_receiveGpu(enum ParamsIOFlag ioFlag); // end of BaseDelivery parameters
39 
40  public:
41  BaseDelivery(char const *name, HyPerCol *hc);
42 
43  virtual ~BaseDelivery() {}
44 
45  virtual void deliver() {}
46 
47  virtual void deliverUnitInput(float *recvBuffer) {}
48 
52  virtual bool isAllInputReady() { return true; }
53 
54  ChannelType getChannelCode() const { return mChannelCode; }
55  bool getReceiveGpu() const { return mReceiveGpu; }
56  HyPerLayer *getPreLayer() const { return mPreLayer; }
57  HyPerLayer *getPostLayer() const { return mPostLayer; }
58 
59  protected:
60  BaseDelivery() {}
61 
62  int initialize(char const *name, HyPerCol *hc);
63 
64  virtual void setObjectType() override;
65 
66  int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override;
67 
68  virtual Response::Status
69  communicateInitInfo(std::shared_ptr<CommunicateInitInfoMessage const> message) override;
70 
71  protected:
72  ChannelType mChannelCode = CHANNEL_EXC;
73  bool mReceiveGpu = false;
74 
75  ConnectionData *mConnectionData = nullptr;
76  HyPerLayer *mPreLayer = nullptr;
77  HyPerLayer *mPostLayer = nullptr;
78  // Rather than the layers, should we store the buffers and the PVLayerLoc data?
79 };
80 
81 } // namespace PV
82 
83 #endif // BASEDELIVERY_HPP_
virtual void ioParam_receiveGpu(enum ParamsIOFlag ioFlag)
receiveGpu: If PetaVision was compiled with GPU acceleration and this flag is set to true...
virtual bool isAllInputReady()
int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
virtual void ioParam_channelCode(enum ParamsIOFlag ioFlag)
channelCode: Specifies which channel in the post layer this connection is attached to ...