File: testmessage2.cc

package info (click to toggle)
sinfo 0.0.48-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 3,332 kB
  • sloc: sh: 11,213; cpp: 6,722; makefile: 271; xml: 151; perl: 149
file content (43 lines) | stat: -rw-r--r-- 1,056 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "messagebasictypes.h"
#include "messagecomplextypes.h"
#include <iostream>

using namespace std;
using namespace Msg;


Message makeMessage()
{
  Message message;
  float x=1.2345;
  pushFrontfloat32(message,x);

  cout << hex << uint64(message.getDataPtr()) << endl;

  return message;
}


int main()
{

  cout << "// the pointer is the same" << endl;
  Message message2=makeMessage();
  cout << "message2.size() " << dec << message2.size() << " " << hex << uint64(message2.getDataPtr()) << endl;
  cout << sizeof(message2.getDataPtr()) << endl;


  cout << "// same data" << endl;
  Message a=message2;
  Message b=message2;
  cout << "a.size() " << dec << a.size() << " " << hex << uint64(a.getDataPtr()) << endl;
  cout << "b.size() " << dec << b.size() << " " << hex << uint64(b.getDataPtr()) << endl;
  float x=1.2345;
  pushFrontfloat32(a,x);
  cout << "a.size() " << dec << a.size() << " " << hex << uint64(a.getDataPtr()) << endl;
  cout << "b.size() " << dec << b.size() << " " << hex << uint64(b.getDataPtr()) << endl;



  return 0;
}