Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-02 08:51:43

0001 #ifndef KINEMATIC_H
0002 #define KINEMATIC_H
0003 
0004 /**
0005  * @file Kinematic.h
0006  * @author: Bryan BERTHOU (SPhN / CEA Saclay)
0007  * @date November 17, 2015
0008  * @version 1.0
0009  */
0010 
0011 #include <ElementaryUtils/parameters/Parameters.h>
0012 #include <string>
0013 #include <vector>
0014 
0015 #include "../BaseObject.h"
0016 #include "channel/ChannelType.h"
0017 
0018 namespace ElemUtils {
0019 class Packet;
0020 } /* namespace ElemUtils */
0021 
0022 namespace PARTONS {
0023 
0024 /**
0025  * @class Kinematic
0026  *
0027  * @brief Base class for all kinematic-like classes.
0028  *
0029  * This class is used as a base (abstract) class for all classes storing kinematics information, like e.g. GPDKinematic or ObservableKinematic.
0030  */
0031 class Kinematic: public BaseObject {
0032 
0033 public:
0034 
0035     /**
0036      * Destructor.
0037      */
0038     virtual ~Kinematic();
0039 
0040     /**
0041      * Configure via parameters.
0042      * @param parameters Set of parameters to be set.
0043      */
0044     virtual void configure(const ElemUtils::Parameters &parameters);
0045 
0046     virtual std::string toString() const;
0047 
0048     /**
0049      * Serialize into given Packet.
0050      * @param packet Target Packet.
0051      */
0052     void serialize(ElemUtils::Packet &packet) const;
0053 
0054     /**
0055      * Retrieve data from given Packet.
0056      * @param packet Input Packet.
0057      */
0058     void unserialize(ElemUtils::Packet &packet);
0059 
0060     /**
0061      * Serialize to std::vector<double>.
0062      */
0063     void serializeIntoStdVector(std::vector<double>& vec) const;
0064 
0065     /**
0066      * Unserialize from std::vector<double>.
0067      */
0068     void unserializeFromStdVector(std::vector<double>::const_iterator& it,
0069             const std::vector<double>::const_iterator& end);
0070 
0071     //********************************************************
0072     //*** SETTERS AND GETTERS ********************************
0073     //********************************************************
0074 
0075     /**
0076      * Get channel type.
0077      */
0078     ChannelType::Type getChannelType() const;
0079 
0080     /**
0081      * Get hash sum of class content.
0082      */
0083     const std::string& getHashSum() const;
0084 
0085     /**
0086      * Set hash sum of class content.
0087      * @param hashSum
0088      */
0089     void setHashSum(const std::string& hashSum) const;
0090 
0091 protected:
0092 
0093     /**
0094      * Default constructor.
0095      * @param className Name of class to be associated to BaseObject (see BaseObject::m_className variable)
0096      */
0097     Kinematic(const std::string &className, ChannelType::Type channelType);
0098 
0099     /**
0100      * Copy constructor.
0101      * @param other Object to be copied.
0102      */
0103     Kinematic(const Kinematic &other);
0104 
0105     /**
0106      * Update hash sum (see Kinematic::m_hashSum variable).
0107      */
0108     virtual void updateHashSum() const = 0;
0109 
0110 private:
0111 
0112     /**
0113      * Channel type.
0114      */
0115     ChannelType::Type m_channelType;
0116 
0117     /**
0118      * Hash sum of class content.
0119      */
0120     mutable std::string m_hashSum;
0121 };
0122 
0123 /**
0124  * Stream operator to serialize class into Packet. See also Kinematic::serialize().
0125  */
0126 ElemUtils::Packet& operator <<(ElemUtils::Packet& packet, Kinematic& kinematic);
0127 
0128 /**
0129  * Stream operator to retrieve class from Packet. See also Kinematic::unserialize().
0130  */
0131 ElemUtils::Packet& operator >>(ElemUtils::Packet& packet, Kinematic& kinematic);
0132 
0133 } /* namespace PARTONS */
0134 
0135 #endif /* KINEMATIC_H */