GCC Code Coverage Report


Directory: ./
File: TESTS/TEST_DAEMONS/TEST_DAEMON_WORKFLOW/DaemonBackend/Shadok.h
Date: 2026-01-15 15:35:36
Exec Total Coverage
Lines: 7 7 100.0%
Functions: 6 6 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #include "phoenix_swarm.h"
8
9 ///@brief Test class
10 class Shadok{
11 public:
12 Shadok(const PString & name, int age);
13 Shadok();
14 virtual ~Shadok();
15
16 void setName(const PString & name);
17 void setAge(int age);
18 const PString & getName() const;
19 const int & getAge() const;
20
21 template<typename Stream, DataStreamMode::DataStreamMode Mode>
22 15 bool readWriteStream(Stream & ds){
23 15 bool b(true);
24 15 b &= DataStream<Stream, Mode, PString >::data_stream(ds, p_name);
25 15 b &= DataStream<Stream, Mode, int >::data_stream(ds, p_age);
26 15 return b;
27 }
28
29 private:
30 ///Name of the Shadok
31 PString p_name;
32 ///Age of the Shadok
33 int p_age;
34 };
35
36 ///@brief Generic Shadok serialisation/deserialisation, load/save and size function
37 template<typename Stream, DataStreamMode::DataStreamMode Mode>
38 struct DataStream<Stream, Mode, Shadok>{
39 ///Generic function to load/save/serialise/deserialise Shadok
40 /** @param[out] ds : stream to be used
41 * @param data : Shadok to be used
42 * @return true on success, false otherwise
43 */
44 15 static bool data_stream(Stream & ds, Shadok & data){
45 15 return data.readWriteStream<Stream, Mode>(ds);
46 }
47 };
48
49 template<>
50 std::string phoenix_getTypeName<Shadok>();
51
52 ///@brief Generic Shadok serialisation/deserialisation function
53 template<>
54 struct CheckStream<Shadok>{
55 ///Check Stream for a Shadok
56 /** @param fieldDescription : description of the field to be checked
57 * @param data : data to be checked
58 * @param reference : reference of the check
59 * @param out : ostream used to collect feed back in case of error (std::cerr or a logger)
60 * @return true on success, false otherwise
61 */
62 static bool check_stream(const std::string & fieldDescription, const Shadok & data, const Shadok & reference, std::ostream & out){
63 bool b = CheckStream<int>::check_stream(fieldDescription + "\n- Shadok::age", data.getAge(), reference.getAge(), out);
64 b &= CheckStream<std::string>::check_stream(fieldDescription + "\n- Shadok::name", data.getName(), reference.getName(), out);
65 return b;
66 }
67 };
68
69
70