1 /*===========================================================================*
2  * This file is part of the Abstract Library for Parallel Search (ALPS).     *
3  *                                                                           *
4  * ALPS is distributed under the Eclipse Public License as part of the       *
5  * COIN-OR repository (http://www.coin-or.org).                              *
6  *                                                                           *
7  * Authors:                                                                  *
8  *                                                                           *
9  *          Yan Xu, Lehigh University                                        *
10  *          Aykut Bulut, Lehigh University                                   *
11  *          Ted Ralphs, Lehigh University                                    *
12  *                                                                           *
13  * Conceptual Design:                                                        *
14  *                                                                           *
15  *          Yan Xu, Lehigh University                                        *
16  *          Ted Ralphs, Lehigh University                                    *
17  *          Laszlo Ladanyi, IBM T.J. Watson Research Center                  *
18  *          Matthew Saltzman, Clemson University                             *
19  *                                                                           *
20  *                                                                           *
21  * Copyright (C) 2001-2019, Lehigh University, Yan Xu, Aykut Bulut, and      *
22  *                          Ted Ralphs.                                      *
23  * All Rights Reserved.                                                      *
24  *===========================================================================*/
25 
26 
27 #include "AlpsKnowledge.h"
28 
AlpsKnowledge(AlpsKnowledgeType type,AlpsKnowledgeBroker * broker)29 AlpsKnowledge::AlpsKnowledge(AlpsKnowledgeType type,
30                              AlpsKnowledgeBroker * broker)
31   : type_(type), broker_(broker) {
32 }
33 
34 // encodes this into a new object and returns a pointer to it.
encode() const35 AlpsEncoded * AlpsKnowledge::encode() const {
36   AlpsEncoded * encoded = new AlpsEncoded(type_);
37   AlpsReturnStatus status = encode(encoded);
38   return encoded;
39 }
40 
41 // encodes this into the given AlpsEncoded object.
encode(AlpsEncoded * encoded) const42 AlpsReturnStatus AlpsKnowledge::encode(AlpsEncoded * encoded) const {
43   encoded->writeRep(*this);
44   return AlpsReturnStatusOk;
45 }
46 
decodeToSelf(AlpsEncoded & encoded)47 AlpsReturnStatus AlpsKnowledge::decodeToSelf(AlpsEncoded & encoded) {
48   encoded.readRep(*this);
49   return AlpsReturnStatusOk;
50 }
51