MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / add

Method add

tests/DCPS/FooTest5/InstanceDataMap.cpp:34–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34int
35InstanceDataMap::add (Xyz::Foo& sample)
36{
37 ACE_GUARD_RETURN (ACE_Thread_Mutex,
38 guard,
39 this->lock_,
40 -1);
41 if (sample.x >= num_samples_per_instance)
42 {
43 ACE_ERROR_RETURN ((LM_ERROR,
44 ACE_TEXT("(%P|%t) ERROR: reader received unexpected message number %d!\n"),
45 sample.x),
46 -1);
47 }
48
49 if (sample.y >= num_datawriters)
50 {
51 ACE_ERROR_RETURN ((LM_ERROR,
52 ACE_TEXT("(%P|%t) ERROR: reader received unexpected message from writer %d!\n"),
53 sample.y),
54 -1);
55 }
56
57 CORBA::ULong length = sample.values.length ();
58
59 if (length != (CORBA::ULong) sequence_length)
60 {
61 ACE_ERROR_RETURN ((LM_ERROR,
62 ACE_TEXT("(%P|%t) ERROR: unexpected sequence length %d expected %d!\n"),
63 length, sequence_length),
64 -1);
65 }
66
67 for (CORBA::ULong i = 0; i < length; i ++)
68 {
69 if (sample.values[i] != sample.x * sample.x - i)
70 {
71 ACE_ERROR_RETURN ((LM_ERROR,
72 ACE_TEXT("(%P|%t) ERROR: incorrect sequence %dth value %f expected %f %x!\n"),
73 i, sample.values[i], sample.x * sample.x - i, sample.values[i]),
74 -1);
75 }
76 }
77
78 DataMap& map = maps_[(int)sample.y];
79 DataMap::ENTRY* entry = 0;
80 if (map.find (sample.data_source, entry) == 0)
81 {
82 if ((entry->int_id_)[(int)sample.x] >= num_receives_per_sample_)
83 {
84 ACE_ERROR ((LM_ERROR,
85 ACE_TEXT("(%P|%t) ERROR: reader received duplicate message %d ")
86 ACE_TEXT("from writer %d!\n"),
87 sample.x, sample.y));
88 return -1;
89 }
90 (entry->int_id_)[(int)sample.x] ++;
91 }

Callers 4

get_dynamic_typeFunction · 0.45
TESTFunction · 0.45
setup_typesupportFunction · 0.45
readFunction · 0.45

Calls 3

lengthMethod · 0.45
findMethod · 0.45
bindMethod · 0.45

Tested by 2

get_dynamic_typeFunction · 0.36
TESTFunction · 0.36