BCP_warmstart_pack.cpp
Go to the documentation of this file.
1 // Copyright (C) 2000, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 
4 #include "BCP_warmstart_dual.hpp"
7 #include "BCP_buffer.hpp"
8 #include "BCP_error.hpp"
9 
10 void
12 {
13  const BCP_warmstart_basis* wsb =
14  dynamic_cast<const BCP_warmstart_basis*>(ws);
15  if (wsb) {
16  const int type = 1;
17  buf.pack(type);
18  wsb->pack(buf);
19  return;
20  }
21 
22  const BCP_warmstart_dual* wsd =
23  dynamic_cast<const BCP_warmstart_dual*>(ws);
24  if (wsd) {
25  const int type = 2;
26  buf.pack(type);
27  wsd->pack(buf);
28  return;
29  }
30 
31  const BCP_warmstart_primaldual* wspd =
32  dynamic_cast<const BCP_warmstart_primaldual*>(ws);
33  if (wspd) {
34  const int type = 3;
35  buf.pack(type);
36  wspd->pack(buf);
37  return;
38  }
39 
40  const int type = 0;
41  buf.pack(type);
42 }
43 
46 {
47  int type;
48  buf.unpack(type);
49  switch (type) {
50  case 0: return NULL;
51  case 1: return new BCP_warmstart_basis(buf);
52  case 2: return new BCP_warmstart_dual(buf);
53  case 3: return new BCP_warmstart_primaldual(buf);
54  default:
55  throw BCP_fatal_error("Unknown warmstart in BCP_unpack_warmstart.\n");
56  }
57  return 0;
58 }
This class describes a warmstart information that consists solely of the dual vector.
BCP_buffer & pack(const T &value)
Pack a single object of type T.
Definition: BCP_buffer.hpp:177
BCP_buffer & unpack(T &value)
Unpack a single object of type T.
Definition: BCP_buffer.hpp:186
void BCP_pack_warmstart(const BCP_warmstart *ws, BCP_buffer &buf)
void pack(BCP_buffer &buf) const
Pack the warmstart info into a buffer.
Warmstarting information for the LP solver.
void pack(BCP_buffer &buf) const
Pack the warmstart info into a buffer.
void fint fint fint real fint real real real real real real real real real fint real fint fint fint real * ws
Currently there isn&#39;t any error handling in BCP.
Definition: BCP_error.hpp:20
This class describes the message buffer used for all processes of BCP.
Definition: BCP_buffer.hpp:39
BCP_warmstart * BCP_unpack_warmstart(BCP_buffer &buf)
This class describes a warmstart information that consists of basis information for structural and ar...
void pack(BCP_buffer &buf) const
Pack the warmstart info into a buffer.
This class describes a warmstart information that consists solely of the dual vector.