00001
00002
00003 #ifndef YOSOKUMOPROTOBUF_H
00004 #define YOSOKUMOPROTOBUF_H
00005
00006 #include "YosokumoDIF.h"
00007 #include "yosokumo.pb.h"
00008
00009 namespace Yosokumo
00010 {
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 class YosokumoProtobuf : public YosokumoDIF
00055 {
00056 public:
00057
00058 std::string getContentType();
00059
00060
00061
00062
00063 public:
00064
00065 bool makeCatalogFromBytes(
00066 const std::vector<uint8_t> &catalogAsBytes,
00067 Catalog &catalog);
00068
00069 private:
00070
00071 bool makeProtobufCatalogFromBytes(
00072 const std::vector<uint8_t> &catalogAsBytes,
00073 ProtoBuf::Catalog &protoCatalog);
00074
00075 bool makeCatalogFromProtobufCatalog(
00076 const ProtoBuf::Catalog &protoCatalog,
00077 Catalog &catalog);
00078
00079
00080
00081 public:
00082
00083 bool makeBytesFromCatalog(
00084 const Catalog &catalog,
00085 std::vector<uint8_t> &catalogAsBytes);
00086
00087 private:
00088
00089 bool makeProtobufCatalogFromCatalog(
00090 const Catalog &catalog,
00091 ProtoBuf::Catalog &protoCatalog);
00092
00093 bool makeBytesFromProtobufCatalog(
00094 const ProtoBuf::Catalog &protoCatalog,
00095 std::vector<uint8_t> &catalogAsBytes);
00096
00097
00098
00099 public:
00100
00101 bool makeStudyFromBytes(
00102 const std::vector<uint8_t> &studyAsBytes,
00103 Study &study);
00104
00105 private:
00106
00107 bool makeProtobufStudyFromBytes(
00108 const std::vector<uint8_t> &studyAsBytes,
00109 ProtoBuf::Study &protoStudy);
00110
00111 bool makeStudyFromProtobufStudy(
00112 const ProtoBuf::Study &protoStudy,
00113 Study &study);
00114
00115
00116
00117 public:
00118
00119 bool makeBytesFromStudy(
00120 const Study &study,
00121 std::vector<uint8_t> &studyAsBytes);
00122
00123 private:
00124
00125 bool makeProtobufStudyFromStudy(
00126 const Study &study,
00127 ProtoBuf::Study &protoStudy);
00128
00129 bool makeBytesFromProtobufStudy(
00130 const ProtoBuf::Study &protoStudy,
00131 std::vector<uint8_t> &studyAsBytes);
00132
00133
00134
00135 public:
00136
00137 bool makeStudyNameFromBytes(
00138 const std::vector<uint8_t> &studyNameAsBytes,
00139 std::string &name);
00140
00141 private:
00142
00143 bool makeProtobufStudyNameControlFromBytes(
00144 const std::vector<uint8_t> &studyNameAsBytes,
00145 ProtoBuf::Panel_StudyNameControl &protoNameControl);
00146
00147 bool makeStudyNameFromProtobufStudyNameControl(
00148 const ProtoBuf::Panel_StudyNameControl &protoNameControl,
00149 std::string &name);
00150
00151
00152
00153 public:
00154
00155 bool makeBytesFromStudyName(
00156 const std::string &name,
00157 std::vector<uint8_t> &studyNameAsBytes);
00158
00159 private:
00160
00161 bool makeProtobufStudyNameControlFromName(
00162 const std::string &name,
00163 ProtoBuf::Panel_StudyNameControl &protoNameControl);
00164
00165 bool makeBytesFromProtobufStudyNameControl(
00166 const ProtoBuf::Panel_StudyNameControl &protoNameControl,
00167 std::vector<uint8_t> &studyNameAsBytes);
00168
00169
00170
00171 public:
00172
00173 bool makeStudyStatusFromBytes(
00174 const std::vector<uint8_t> &studyStatusAsBytes,
00175 Study::Status &status);
00176
00177 private:
00178
00179 bool makeProtobufStudyStatusControlFromBytes(
00180 const std::vector<uint8_t> &studyStatusAsBytes,
00181 ProtoBuf::Panel_StatusControl &protoStatusControl);
00182
00183 bool makeStudyStatusFromProtobufStudyStatusControl(
00184 const ProtoBuf::Panel_StatusControl &protoStatusControl,
00185 Study::Status &status);
00186
00187
00188
00189 public:
00190
00191 bool makeBytesFromStudyStatus(
00192 const Study::Status status,
00193 std::vector<uint8_t> &studyStatusAsBytes);
00194
00195 private:
00196
00197 bool makeProtobufStudyStatusControlFromStatus(
00198 const Study::Status status,
00199 ProtoBuf::Panel_StatusControl &protoStatusControl);
00200
00201 bool makeBytesFromProtobufStudyStatusControl(
00202 const ProtoBuf::Panel_StatusControl &protoStatusControl,
00203 std::vector<uint8_t> &studyStatusAsBytes);
00204
00205
00206 public:
00207
00208 bool makeStudyVisibilityFromBytes(
00209 const std::vector<uint8_t> &studyVisibilityAsBytes,
00210 Study::Visibility &visibility);
00211
00212 private:
00213
00214 bool makeProtobufStudyVisibilityControlFromBytes(
00215 const std::vector<uint8_t> &studyVisibilityAsBytes,
00216 ProtoBuf::Panel_VisibilityControl &protoVisibilityControl);
00217
00218 bool makeStudyVisibilityFromProtobufStudyVisibilityControl(
00219 const ProtoBuf::Panel_VisibilityControl &protoVisibilityControl,
00220 Study::Visibility &visibility);
00221
00222
00223
00224 public:
00225
00226 bool makeBytesFromStudyVisibility(
00227 const Study::Visibility visibility,
00228 std::vector<uint8_t> &studyVisibilityBytes);
00229
00230 private:
00231
00232 bool makeProtobufStudyVisibilityControlFromVisibility(
00233 const Study::Visibility visibility,
00234 ProtoBuf::Panel_VisibilityControl &protoVisibilityControl);
00235
00236 bool makeBytesFromProtobufStudyVisibilityControl(
00237 const ProtoBuf::Panel_VisibilityControl &protoVisibilityControl,
00238 std::vector<uint8_t> &studyVisibilityBytes);
00239
00240
00241 public:
00242
00243 bool makePanelFromBytes(
00244 const std::vector<uint8_t> &panelAsBytes,
00245 Panel &panel);
00246
00247 private:
00248
00249 bool makeProtobufPanelFromBytes(
00250 const std::vector<uint8_t> &panelAsBytes,
00251 ProtoBuf::Panel &protoPanel);
00252
00253 bool makePanelFromProtobufPanel(
00254 const ProtoBuf::Panel &protoPanel,
00255 Panel &panel);
00256
00257
00258 public:
00259
00260 bool makeBytesFromPanel(
00261 const Panel &panel,
00262 std::vector<uint8_t> &panelAsBytes);
00263
00264 private:
00265
00266 bool makeProtobufPanelFromPanel(
00267 const Panel &panel,
00268 ProtoBuf::Panel &protoPanel);
00269
00270 bool makeBytesFromProtobufPanel(
00271 const ProtoBuf::Panel &protoPanel,
00272 std::vector<uint8_t> &panelAsBytes);
00273
00274
00275
00276 public:
00277
00278 bool makeRoleFromBytes(
00279 const std::vector<uint8_t> &roleAsBytes,
00280 Role &role);
00281
00282 private:
00283
00284 bool makeProtobufRoleFromBytes(
00285 const std::vector<uint8_t> &roleAsBytes,
00286 ProtoBuf::Role &protoRole);
00287
00288 bool makeRoleFromProtobufRole(
00289 const ProtoBuf::Role &protoRole,
00290 Role &role);
00291
00292
00293
00294 public:
00295
00296 bool makeBytesFromRole(
00297 const Role &role,
00298 std::vector<uint8_t> &roleAsBytes);
00299
00300 private:
00301
00302 bool makeProtobufRoleFromRole(
00303 const Role &role,
00304 ProtoBuf::Role &protoRole);
00305
00306 bool makeBytesFromProtobufRole(
00307 const ProtoBuf::Role &protoRole,
00308 std::vector<uint8_t> &roleAsBytes);
00309
00310
00311
00312 public:
00313
00314 bool makeRosterFromBytes(
00315 const std::vector<uint8_t> &rosterAsBytes,
00316 Roster &roster);
00317
00318 private:
00319
00320 bool makeProtobufRosterFromBytes(
00321 const std::vector<uint8_t> &rosterAsBytes,
00322 ProtoBuf::Roster &protoRoster);
00323
00324 bool makeRosterFromProtobufRoster(
00325 const ProtoBuf::Roster &protoRoster,
00326 Roster &roster);
00327
00328
00329
00330 public:
00331
00332 bool makeBytesFromRoster(
00333 const Roster &roster,
00334 std::vector<uint8_t> &rosterAsBytes);
00335
00336 private:
00337
00338 bool makeProtobufRosterFromRoster(
00339 const Roster &roster,
00340 ProtoBuf::Roster &protoRoster);
00341
00342 bool makeBytesFromProtobufRoster(
00343 const ProtoBuf::Roster &protoRoster,
00344 std::vector<uint8_t> &rosterAsBytes);
00345
00346
00347
00348 public:
00349
00350 bool makePredictorFromBytes(
00351 const std::vector<uint8_t> &predictorAsBytes,
00352 Predictor &predictor);
00353
00354 private:
00355
00356 bool makeProtobufPredictorFromBytes(
00357 const std::vector<uint8_t> &predictorAsBytes,
00358 ProtoBuf::Predictor &protoPredictor);
00359
00360 bool makePredictorFromProtobufPredictor(
00361 const ProtoBuf::Predictor &protoPredictor,
00362 Predictor &predictor);
00363
00364
00365
00366 public:
00367
00368 bool makeBytesFromPredictor(
00369 const Predictor &predictor,
00370 std::vector<uint8_t> &predictorAsBytes);
00371
00372 private:
00373
00374 bool makeProtobufPredictorFromPredictor(
00375 const Predictor &predictor,
00376 ProtoBuf::Predictor &protoPredictor);
00377
00378 bool makeBytesFromProtobufPredictor(
00379 const ProtoBuf::Predictor &protoPredictor,
00380 std::vector<uint8_t> &predictorAsBytes);
00381
00382
00383 public:
00384
00385 bool makeCellFromBytes(
00386 const std::vector<uint8_t> &cellAsBytes,
00387 Cell &cell);
00388
00389 private:
00390
00391 bool makeProtobufCellFromBytes(
00392 const std::vector<uint8_t> &cellAsBytes,
00393 ProtoBuf::Cell &protoCell);
00394
00395 bool makeCellFromProtobufCell(
00396 const ProtoBuf::Cell &protoCell,
00397 Cell &cell);
00398
00399
00400
00401 public:
00402
00403 bool makeBytesFromCell(
00404 const Cell &cell,
00405 std::vector<uint8_t> &cellAsBytes);
00406
00407 private:
00408
00409 bool makeProtobufCellFromCell(
00410 const Cell &cell,
00411 ProtoBuf::Cell &protoCell);
00412
00413 bool makeBytesFromProtobufCell(
00414 const ProtoBuf::Cell &protoCell,
00415 std::vector<uint8_t> &cellAsBytes);
00416
00417
00418 public:
00419
00420 bool makeSpecimenFromBytes(
00421 const std::vector<uint8_t> &specimenAsBytes,
00422 Specimen &specimen);
00423
00424 private:
00425
00426 bool makeProtobufSpecimenFromBytes(
00427 const std::vector<uint8_t> &specimenAsBytes,
00428 ProtoBuf::Specimen &protoSpecimen);
00429
00430 bool makeSpecimenFromProtobufSpecimen(
00431 const ProtoBuf::Specimen &protoSpecimen,
00432 Specimen &specimen);
00433
00434
00435
00436 public:
00437
00438 bool makeBytesFromSpecimen(
00439 const Specimen &specimen,
00440 std::vector<uint8_t> &specimenAsBytes);
00441
00442 private:
00443
00444 bool makeProtobufSpecimenFromSpecimen(
00445 const Specimen &specimen,
00446 ProtoBuf::Specimen &protoSpecimen);
00447
00448 bool makeBytesFromProtobufSpecimen(
00449 const ProtoBuf::Specimen &protoSpecimen,
00450 std::vector<uint8_t> &specimenAsBytes);
00451
00452
00453
00454 public:
00455
00456 bool makeBlockFromBytes(
00457 const std::vector<uint8_t> &blockAsBytes,
00458 Block &block);
00459
00460 private:
00461
00462 bool makeProtobufBlockFromBytes(
00463 const std::vector<uint8_t> &blockAsBytes,
00464 ProtoBuf::Block &protoBlock);
00465
00466 bool makeBlockFromProtobufBlock(
00467 const ProtoBuf::Block &protoBlock,
00468 Block &block);
00469
00470
00471
00472 public:
00473
00474 bool makeBytesFromBlock(
00475 const Block &block,
00476 std::vector<uint8_t> &blockAsBytes);
00477
00478 private:
00479
00480 bool makeProtobufBlockFromBlock(
00481 const Block &block,
00482 ProtoBuf::Block &protoBlock);
00483
00484 bool makeBytesFromProtobufBlock(
00485 const ProtoBuf::Block &protoBlock,
00486 std::vector<uint8_t> &blockAsBytes);
00487
00488
00489
00490 public:
00491
00492 bool makeMessageFromBytes(
00493 const std::vector<uint8_t> &messageAsBytes,
00494 Message &message);
00495
00496 private:
00497
00498 bool makeProtobufMessageFromBytes(
00499 const std::vector<uint8_t> &messageAsBytes,
00500 ProtoBuf::Message &protoMessage);
00501
00502 bool makeMessageFromProtobufMessage(
00503 const ProtoBuf::Message &protoMessage,
00504 Message &m);
00505
00506
00507
00508 public:
00509
00510 bool makeBytesFromMessage(
00511 const Message &message,
00512 std::vector<uint8_t> &messageAsBytes);
00513
00514 private:
00515
00516 bool makeProtobufMessageFromMessage(
00517 const Message &message,
00518 ProtoBuf::Message &protoMessage);
00519
00520 bool makeBytesFromProtobufMessage(
00521 const ProtoBuf::Message &protoMessage,
00522 std::vector<uint8_t> &messageAsBytes);
00523
00524
00525
00526 private:
00527
00528 bool protoTypeToType(
00529 ProtoBuf::Study_Type protoType,
00530 Study::Type &type);
00531
00532 bool typeToProtobufType(
00533 Study::Type type,
00534 ProtoBuf::Study_Type &protoType);
00535
00536 bool protoStatusToStatus(
00537 ProtoBuf::Study_Status protoStatus,
00538 Study::Status &status);
00539
00540 bool statusToProtobufStatus(
00541 Study::Status status,
00542 ProtoBuf::Study_Status &protoStatus);
00543
00544 bool protoVisibilityToVisibility(
00545 ProtoBuf::Study_Visibility protoVisibility,
00546 Study::Visibility &visibility);
00547
00548 bool visibilityToProtobufVisibility(
00549 Study::Visibility visibility,
00550 ProtoBuf::Study_Visibility &protoVisibility);
00551
00552 bool protoTypeToType(
00553 ProtoBuf::Message_Type protoType,
00554 Message::Type &type);
00555
00556 bool typeToProtobufType(
00557 Message::Type type,
00558 ProtoBuf::Message_Type &protoType);
00559
00560 bool protoStatusToStatus(
00561 ProtoBuf::Predictor_Status protoStatus,
00562 Predictor::Status &status);
00563
00564 bool statusToProtobufStatus(
00565 Predictor::Status status,
00566 ProtoBuf::Predictor_Status &protoStatus);
00567
00568 bool protoTypeToType(
00569 ProtoBuf::Predictor_Type protoType,
00570 Predictor::Type &type);
00571
00572 bool typeToProtobufType(
00573 Predictor::Type type,
00574 ProtoBuf::Predictor_Type &protoType);
00575
00576 bool protoLevelToLevel(
00577 ProtoBuf::Predictor_Level protoLevel,
00578 Predictor::Level &level);
00579
00580 bool levelToProtobufLevel(
00581 Predictor::Level level,
00582 ProtoBuf::Predictor_Level &protoLevel);
00583
00584 bool protoStatusToStatus(
00585 ProtoBuf::Specimen_Status protoStatus,
00586 Specimen::Status &status);
00587
00588 bool statusToProtobufStatus(
00589 Specimen::Status status,
00590 ProtoBuf::Specimen_Status &protoStatus);
00591
00592 };
00593
00594 }
00595
00596 #endif // YOSOKUMOPROTOBUF_H
00597
00598