message HealthOccurrenceCount
{
required int64 HealthID=1;
required int32 OccCount=2;
optional bytes wci=3;
}
我想添加基于的数据HealthID
;如果HealthID
已输入,则程序不应添加新条目,而应仅增加现有条目的OccCount
.
HealthOccurrenceCount objHelthOccCount;
if(objHelthOccCount.healthid() == healthID) // Is this right or do I need to iterate all the nodes?
{
occCount++;
objHelthOccCount.set_occcount(occCount);
}
else
occCount = 1;
这段代码是正确的还是我应该转换HealthID
成字符串?
生成的代码:
// required int64 HealthID = 1;
inline bool has_healthid() const;
inline void clear_healthid();
static const int kHealthIDFieldNumber = 1;
inline ::google::protobuf::int64 healthid() const;
inline void set_healthid(::google::protobuf::int64 value);