unittest_optimize_for.pb.cc 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // source: google/protobuf/unittest_optimize_for.proto
  3. #include <google/protobuf/unittest_optimize_for.pb.h>
  4. #include <algorithm>
  5. #include <google/protobuf/stubs/common.h>
  6. #include <google/protobuf/stubs/port.h>
  7. #include <google/protobuf/io/coded_stream.h>
  8. #include <google/protobuf/wire_format_lite_inl.h>
  9. #include <google/protobuf/descriptor.h>
  10. #include <google/protobuf/generated_message_reflection.h>
  11. #include <google/protobuf/reflection_ops.h>
  12. #include <google/protobuf/wire_format.h>
  13. // This is a temporary google only hack
  14. #ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  15. #include "third_party/protobuf/version.h"
  16. #endif
  17. // @@protoc_insertion_point(includes)
  18. namespace protobuf_google_2fprotobuf_2funittest_2eproto {
  19. extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2funittest_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_ForeignMessage;
  20. } // namespace protobuf_google_2fprotobuf_2funittest_2eproto
  21. namespace protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto {
  22. extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_TestRequiredOptimizedForSize;
  23. } // namespace protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto
  24. namespace protobuf_unittest {
  25. class TestOptimizedForSizeDefaultTypeInternal {
  26. public:
  27. ::google::protobuf::internal::ExplicitlyConstructed<TestOptimizedForSize>
  28. _instance;
  29. ::google::protobuf::int32 integer_field_;
  30. ::google::protobuf::internal::ArenaStringPtr string_field_;
  31. } _TestOptimizedForSize_default_instance_;
  32. class TestRequiredOptimizedForSizeDefaultTypeInternal {
  33. public:
  34. ::google::protobuf::internal::ExplicitlyConstructed<TestRequiredOptimizedForSize>
  35. _instance;
  36. } _TestRequiredOptimizedForSize_default_instance_;
  37. class TestOptionalOptimizedForSizeDefaultTypeInternal {
  38. public:
  39. ::google::protobuf::internal::ExplicitlyConstructed<TestOptionalOptimizedForSize>
  40. _instance;
  41. } _TestOptionalOptimizedForSize_default_instance_;
  42. } // namespace protobuf_unittest
  43. namespace protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto {
  44. static void InitDefaultsTestOptimizedForSize() {
  45. GOOGLE_PROTOBUF_VERIFY_VERSION;
  46. {
  47. void* ptr = &::protobuf_unittest::_TestOptimizedForSize_default_instance_;
  48. new (ptr) ::protobuf_unittest::TestOptimizedForSize();
  49. ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  50. }
  51. ::protobuf_unittest::TestOptimizedForSize::InitAsDefaultInstance();
  52. }
  53. ::google::protobuf::internal::SCCInfo<1> scc_info_TestOptimizedForSize =
  54. {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsTestOptimizedForSize}, {
  55. &protobuf_google_2fprotobuf_2funittest_2eproto::scc_info_ForeignMessage.base,}};
  56. static void InitDefaultsTestRequiredOptimizedForSize() {
  57. GOOGLE_PROTOBUF_VERIFY_VERSION;
  58. {
  59. void* ptr = &::protobuf_unittest::_TestRequiredOptimizedForSize_default_instance_;
  60. new (ptr) ::protobuf_unittest::TestRequiredOptimizedForSize();
  61. ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  62. }
  63. ::protobuf_unittest::TestRequiredOptimizedForSize::InitAsDefaultInstance();
  64. }
  65. ::google::protobuf::internal::SCCInfo<0> scc_info_TestRequiredOptimizedForSize =
  66. {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsTestRequiredOptimizedForSize}, {}};
  67. static void InitDefaultsTestOptionalOptimizedForSize() {
  68. GOOGLE_PROTOBUF_VERIFY_VERSION;
  69. {
  70. void* ptr = &::protobuf_unittest::_TestOptionalOptimizedForSize_default_instance_;
  71. new (ptr) ::protobuf_unittest::TestOptionalOptimizedForSize();
  72. ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  73. }
  74. ::protobuf_unittest::TestOptionalOptimizedForSize::InitAsDefaultInstance();
  75. }
  76. ::google::protobuf::internal::SCCInfo<1> scc_info_TestOptionalOptimizedForSize =
  77. {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsTestOptionalOptimizedForSize}, {
  78. &protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::scc_info_TestRequiredOptimizedForSize.base,}};
  79. void InitDefaults() {
  80. ::google::protobuf::internal::InitSCC(&scc_info_TestOptimizedForSize.base);
  81. ::google::protobuf::internal::InitSCC(&scc_info_TestRequiredOptimizedForSize.base);
  82. ::google::protobuf::internal::InitSCC(&scc_info_TestOptionalOptimizedForSize.base);
  83. }
  84. ::google::protobuf::Metadata file_level_metadata[3];
  85. const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  86. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestOptimizedForSize, _has_bits_),
  87. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestOptimizedForSize, _internal_metadata_),
  88. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestOptimizedForSize, _extensions_),
  89. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestOptimizedForSize, _oneof_case_[0]),
  90. ~0u, // no _weak_field_map_
  91. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestOptimizedForSize, i_),
  92. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestOptimizedForSize, msg_),
  93. offsetof(::protobuf_unittest::TestOptimizedForSizeDefaultTypeInternal, integer_field_),
  94. offsetof(::protobuf_unittest::TestOptimizedForSizeDefaultTypeInternal, string_field_),
  95. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestOptimizedForSize, foo_),
  96. 1,
  97. 0,
  98. ~0u,
  99. ~0u,
  100. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestRequiredOptimizedForSize, _has_bits_),
  101. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestRequiredOptimizedForSize, _internal_metadata_),
  102. ~0u, // no _extensions_
  103. ~0u, // no _oneof_case_
  104. ~0u, // no _weak_field_map_
  105. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestRequiredOptimizedForSize, x_),
  106. 0,
  107. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestOptionalOptimizedForSize, _has_bits_),
  108. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestOptionalOptimizedForSize, _internal_metadata_),
  109. ~0u, // no _extensions_
  110. ~0u, // no _oneof_case_
  111. ~0u, // no _weak_field_map_
  112. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestOptionalOptimizedForSize, o_),
  113. 0,
  114. };
  115. static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  116. { 0, 10, sizeof(::protobuf_unittest::TestOptimizedForSize)},
  117. { 14, 20, sizeof(::protobuf_unittest::TestRequiredOptimizedForSize)},
  118. { 21, 27, sizeof(::protobuf_unittest::TestOptionalOptimizedForSize)},
  119. };
  120. static ::google::protobuf::Message const * const file_default_instances[] = {
  121. reinterpret_cast<const ::google::protobuf::Message*>(&::protobuf_unittest::_TestOptimizedForSize_default_instance_),
  122. reinterpret_cast<const ::google::protobuf::Message*>(&::protobuf_unittest::_TestRequiredOptimizedForSize_default_instance_),
  123. reinterpret_cast<const ::google::protobuf::Message*>(&::protobuf_unittest::_TestOptionalOptimizedForSize_default_instance_),
  124. };
  125. void protobuf_AssignDescriptors() {
  126. AddDescriptors();
  127. AssignDescriptors(
  128. "google/protobuf/unittest_optimize_for.proto", schemas, file_default_instances, TableStruct::offsets,
  129. file_level_metadata, NULL, NULL);
  130. }
  131. void protobuf_AssignDescriptorsOnce() {
  132. static ::google::protobuf::internal::once_flag once;
  133. ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
  134. }
  135. void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
  136. void protobuf_RegisterTypes(const ::std::string&) {
  137. protobuf_AssignDescriptorsOnce();
  138. ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 3);
  139. }
  140. void AddDescriptorsImpl() {
  141. InitDefaults();
  142. static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  143. "\n+google/protobuf/unittest_optimize_for."
  144. "proto\022\021protobuf_unittest\032\036google/protobu"
  145. "f/unittest.proto\"\312\002\n\024TestOptimizedForSiz"
  146. "e\022\t\n\001i\030\001 \001(\005\022.\n\003msg\030\023 \001(\0132!.protobuf_uni"
  147. "ttest.ForeignMessage\022\027\n\rinteger_field\030\002 "
  148. "\001(\005H\000\022\026\n\014string_field\030\003 \001(\tH\000*\t\010\350\007\020\200\200\200\200\002"
  149. "2@\n\016test_extension\022\'.protobuf_unittest.T"
  150. "estOptimizedForSize\030\322\t \001(\0052r\n\017test_exten"
  151. "sion2\022\'.protobuf_unittest.TestOptimizedF"
  152. "orSize\030\323\t \001(\0132/.protobuf_unittest.TestRe"
  153. "quiredOptimizedForSizeB\005\n\003foo\")\n\034TestReq"
  154. "uiredOptimizedForSize\022\t\n\001x\030\001 \002(\005\"Z\n\034Test"
  155. "OptionalOptimizedForSize\022:\n\001o\030\001 \001(\0132/.pr"
  156. "otobuf_unittest.TestRequiredOptimizedFor"
  157. "SizeB\002H\002"
  158. };
  159. ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
  160. descriptor, 568);
  161. ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
  162. "google/protobuf/unittest_optimize_for.proto", &protobuf_RegisterTypes);
  163. ::protobuf_google_2fprotobuf_2funittest_2eproto::AddDescriptors();
  164. }
  165. void AddDescriptors() {
  166. static ::google::protobuf::internal::once_flag once;
  167. ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
  168. }
  169. // Force AddDescriptors() to be called at dynamic initialization time.
  170. struct StaticDescriptorInitializer {
  171. StaticDescriptorInitializer() {
  172. AddDescriptors();
  173. }
  174. } static_descriptor_initializer;
  175. } // namespace protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto
  176. namespace protobuf_unittest {
  177. // ===================================================================
  178. void TestOptimizedForSize::InitAsDefaultInstance() {
  179. ::protobuf_unittest::_TestOptimizedForSize_default_instance_._instance.get_mutable()->msg_ = const_cast< ::protobuf_unittest::ForeignMessage*>(
  180. ::protobuf_unittest::ForeignMessage::internal_default_instance());
  181. ::protobuf_unittest::_TestOptimizedForSize_default_instance_.integer_field_ = 0;
  182. ::protobuf_unittest::_TestOptimizedForSize_default_instance_.string_field_.UnsafeSetDefault(
  183. &::google::protobuf::internal::GetEmptyStringAlreadyInited());
  184. }
  185. void TestOptimizedForSize::clear_msg() {
  186. if (msg_ != NULL) msg_->Clear();
  187. clear_has_msg();
  188. }
  189. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  190. const int TestOptimizedForSize::kIFieldNumber;
  191. const int TestOptimizedForSize::kMsgFieldNumber;
  192. const int TestOptimizedForSize::kIntegerFieldFieldNumber;
  193. const int TestOptimizedForSize::kStringFieldFieldNumber;
  194. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  195. TestOptimizedForSize::TestOptimizedForSize()
  196. : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  197. ::google::protobuf::internal::InitSCC(
  198. &protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::scc_info_TestOptimizedForSize.base);
  199. SharedCtor();
  200. // @@protoc_insertion_point(constructor:protobuf_unittest.TestOptimizedForSize)
  201. }
  202. TestOptimizedForSize::TestOptimizedForSize(const TestOptimizedForSize& from)
  203. : ::google::protobuf::Message(),
  204. _internal_metadata_(NULL),
  205. _has_bits_(from._has_bits_) {
  206. _internal_metadata_.MergeFrom(from._internal_metadata_);
  207. _extensions_.MergeFrom(from._extensions_);
  208. if (from.has_msg()) {
  209. msg_ = new ::protobuf_unittest::ForeignMessage(*from.msg_);
  210. } else {
  211. msg_ = NULL;
  212. }
  213. i_ = from.i_;
  214. clear_has_foo();
  215. switch (from.foo_case()) {
  216. case kIntegerField: {
  217. set_integer_field(from.integer_field());
  218. break;
  219. }
  220. case kStringField: {
  221. set_string_field(from.string_field());
  222. break;
  223. }
  224. case FOO_NOT_SET: {
  225. break;
  226. }
  227. }
  228. // @@protoc_insertion_point(copy_constructor:protobuf_unittest.TestOptimizedForSize)
  229. }
  230. void TestOptimizedForSize::SharedCtor() {
  231. ::memset(&msg_, 0, static_cast<size_t>(
  232. reinterpret_cast<char*>(&i_) -
  233. reinterpret_cast<char*>(&msg_)) + sizeof(i_));
  234. clear_has_foo();
  235. }
  236. TestOptimizedForSize::~TestOptimizedForSize() {
  237. // @@protoc_insertion_point(destructor:protobuf_unittest.TestOptimizedForSize)
  238. SharedDtor();
  239. }
  240. void TestOptimizedForSize::SharedDtor() {
  241. if (this != internal_default_instance()) delete msg_;
  242. if (has_foo()) {
  243. clear_foo();
  244. }
  245. }
  246. void TestOptimizedForSize::SetCachedSize(int size) const {
  247. _cached_size_.Set(size);
  248. }
  249. const ::google::protobuf::Descriptor* TestOptimizedForSize::descriptor() {
  250. ::protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::protobuf_AssignDescriptorsOnce();
  251. return ::protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
  252. }
  253. const TestOptimizedForSize& TestOptimizedForSize::default_instance() {
  254. ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::scc_info_TestOptimizedForSize.base);
  255. return *internal_default_instance();
  256. }
  257. void TestOptimizedForSize::clear_foo() {
  258. // @@protoc_insertion_point(one_of_clear_start:protobuf_unittest.TestOptimizedForSize)
  259. switch (foo_case()) {
  260. case kIntegerField: {
  261. // No need to clear
  262. break;
  263. }
  264. case kStringField: {
  265. foo_.string_field_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  266. break;
  267. }
  268. case FOO_NOT_SET: {
  269. break;
  270. }
  271. }
  272. _oneof_case_[0] = FOO_NOT_SET;
  273. }
  274. void TestOptimizedForSize::Swap(TestOptimizedForSize* other) {
  275. if (other == this) return;
  276. InternalSwap(other);
  277. }
  278. void TestOptimizedForSize::InternalSwap(TestOptimizedForSize* other) {
  279. using std::swap;
  280. GetReflection()->Swap(this, other);}
  281. ::google::protobuf::Metadata TestOptimizedForSize::GetMetadata() const {
  282. protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::protobuf_AssignDescriptorsOnce();
  283. return ::protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::file_level_metadata[kIndexInFileMessages];
  284. }
  285. // ===================================================================
  286. void TestRequiredOptimizedForSize::InitAsDefaultInstance() {
  287. }
  288. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  289. const int TestRequiredOptimizedForSize::kXFieldNumber;
  290. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  291. TestRequiredOptimizedForSize::TestRequiredOptimizedForSize()
  292. : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  293. ::google::protobuf::internal::InitSCC(
  294. &protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::scc_info_TestRequiredOptimizedForSize.base);
  295. SharedCtor();
  296. // @@protoc_insertion_point(constructor:protobuf_unittest.TestRequiredOptimizedForSize)
  297. }
  298. TestRequiredOptimizedForSize::TestRequiredOptimizedForSize(const TestRequiredOptimizedForSize& from)
  299. : ::google::protobuf::Message(),
  300. _internal_metadata_(NULL),
  301. _has_bits_(from._has_bits_) {
  302. _internal_metadata_.MergeFrom(from._internal_metadata_);
  303. x_ = from.x_;
  304. // @@protoc_insertion_point(copy_constructor:protobuf_unittest.TestRequiredOptimizedForSize)
  305. }
  306. void TestRequiredOptimizedForSize::SharedCtor() {
  307. x_ = 0;
  308. }
  309. TestRequiredOptimizedForSize::~TestRequiredOptimizedForSize() {
  310. // @@protoc_insertion_point(destructor:protobuf_unittest.TestRequiredOptimizedForSize)
  311. SharedDtor();
  312. }
  313. void TestRequiredOptimizedForSize::SharedDtor() {
  314. }
  315. void TestRequiredOptimizedForSize::SetCachedSize(int size) const {
  316. _cached_size_.Set(size);
  317. }
  318. const ::google::protobuf::Descriptor* TestRequiredOptimizedForSize::descriptor() {
  319. ::protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::protobuf_AssignDescriptorsOnce();
  320. return ::protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
  321. }
  322. const TestRequiredOptimizedForSize& TestRequiredOptimizedForSize::default_instance() {
  323. ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::scc_info_TestRequiredOptimizedForSize.base);
  324. return *internal_default_instance();
  325. }
  326. void TestRequiredOptimizedForSize::Swap(TestRequiredOptimizedForSize* other) {
  327. if (other == this) return;
  328. InternalSwap(other);
  329. }
  330. void TestRequiredOptimizedForSize::InternalSwap(TestRequiredOptimizedForSize* other) {
  331. using std::swap;
  332. GetReflection()->Swap(this, other);}
  333. ::google::protobuf::Metadata TestRequiredOptimizedForSize::GetMetadata() const {
  334. protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::protobuf_AssignDescriptorsOnce();
  335. return ::protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::file_level_metadata[kIndexInFileMessages];
  336. }
  337. // ===================================================================
  338. void TestOptionalOptimizedForSize::InitAsDefaultInstance() {
  339. ::protobuf_unittest::_TestOptionalOptimizedForSize_default_instance_._instance.get_mutable()->o_ = const_cast< ::protobuf_unittest::TestRequiredOptimizedForSize*>(
  340. ::protobuf_unittest::TestRequiredOptimizedForSize::internal_default_instance());
  341. }
  342. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  343. const int TestOptionalOptimizedForSize::kOFieldNumber;
  344. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  345. TestOptionalOptimizedForSize::TestOptionalOptimizedForSize()
  346. : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  347. ::google::protobuf::internal::InitSCC(
  348. &protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::scc_info_TestOptionalOptimizedForSize.base);
  349. SharedCtor();
  350. // @@protoc_insertion_point(constructor:protobuf_unittest.TestOptionalOptimizedForSize)
  351. }
  352. TestOptionalOptimizedForSize::TestOptionalOptimizedForSize(const TestOptionalOptimizedForSize& from)
  353. : ::google::protobuf::Message(),
  354. _internal_metadata_(NULL),
  355. _has_bits_(from._has_bits_) {
  356. _internal_metadata_.MergeFrom(from._internal_metadata_);
  357. if (from.has_o()) {
  358. o_ = new ::protobuf_unittest::TestRequiredOptimizedForSize(*from.o_);
  359. } else {
  360. o_ = NULL;
  361. }
  362. // @@protoc_insertion_point(copy_constructor:protobuf_unittest.TestOptionalOptimizedForSize)
  363. }
  364. void TestOptionalOptimizedForSize::SharedCtor() {
  365. o_ = NULL;
  366. }
  367. TestOptionalOptimizedForSize::~TestOptionalOptimizedForSize() {
  368. // @@protoc_insertion_point(destructor:protobuf_unittest.TestOptionalOptimizedForSize)
  369. SharedDtor();
  370. }
  371. void TestOptionalOptimizedForSize::SharedDtor() {
  372. if (this != internal_default_instance()) delete o_;
  373. }
  374. void TestOptionalOptimizedForSize::SetCachedSize(int size) const {
  375. _cached_size_.Set(size);
  376. }
  377. const ::google::protobuf::Descriptor* TestOptionalOptimizedForSize::descriptor() {
  378. ::protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::protobuf_AssignDescriptorsOnce();
  379. return ::protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
  380. }
  381. const TestOptionalOptimizedForSize& TestOptionalOptimizedForSize::default_instance() {
  382. ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::scc_info_TestOptionalOptimizedForSize.base);
  383. return *internal_default_instance();
  384. }
  385. void TestOptionalOptimizedForSize::Swap(TestOptionalOptimizedForSize* other) {
  386. if (other == this) return;
  387. InternalSwap(other);
  388. }
  389. void TestOptionalOptimizedForSize::InternalSwap(TestOptionalOptimizedForSize* other) {
  390. using std::swap;
  391. GetReflection()->Swap(this, other);}
  392. ::google::protobuf::Metadata TestOptionalOptimizedForSize::GetMetadata() const {
  393. protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::protobuf_AssignDescriptorsOnce();
  394. return ::protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::file_level_metadata[kIndexInFileMessages];
  395. }
  396. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  397. const int TestOptimizedForSize::kTestExtensionFieldNumber;
  398. #endif
  399. ::google::protobuf::internal::ExtensionIdentifier< ::protobuf_unittest::TestOptimizedForSize,
  400. ::google::protobuf::internal::PrimitiveTypeTraits< ::google::protobuf::int32 >, 5, false >
  401. TestOptimizedForSize::test_extension(kTestExtensionFieldNumber, 0);
  402. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  403. const int TestOptimizedForSize::kTestExtension2FieldNumber;
  404. #endif
  405. ::google::protobuf::internal::ExtensionIdentifier< ::protobuf_unittest::TestOptimizedForSize,
  406. ::google::protobuf::internal::MessageTypeTraits< ::protobuf_unittest::TestRequiredOptimizedForSize >, 11, false >
  407. TestOptimizedForSize::test_extension2(kTestExtension2FieldNumber, *::protobuf_unittest::TestRequiredOptimizedForSize::internal_default_instance());
  408. // @@protoc_insertion_point(namespace_scope)
  409. } // namespace protobuf_unittest
  410. namespace google {
  411. namespace protobuf {
  412. template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::protobuf_unittest::TestOptimizedForSize* Arena::CreateMaybeMessage< ::protobuf_unittest::TestOptimizedForSize >(Arena* arena) {
  413. return Arena::CreateInternal< ::protobuf_unittest::TestOptimizedForSize >(arena);
  414. }
  415. template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::protobuf_unittest::TestRequiredOptimizedForSize* Arena::CreateMaybeMessage< ::protobuf_unittest::TestRequiredOptimizedForSize >(Arena* arena) {
  416. return Arena::CreateInternal< ::protobuf_unittest::TestRequiredOptimizedForSize >(arena);
  417. }
  418. template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::protobuf_unittest::TestOptionalOptimizedForSize* Arena::CreateMaybeMessage< ::protobuf_unittest::TestOptionalOptimizedForSize >(Arena* arena) {
  419. return Arena::CreateInternal< ::protobuf_unittest::TestOptionalOptimizedForSize >(arena);
  420. }
  421. } // namespace protobuf
  422. } // namespace google
  423. // @@protoc_insertion_point(global_scope)