Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

BCP_warmstart_pack.cpp

00001 // Copyright (C) 2000, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 
00004 #include "BCP_warmstart_dual.hpp"
00005 #include "BCP_warmstart_basis.hpp"
00006 #include "BCP_buffer.hpp"
00007 #include "BCP_error.hpp"
00008 
00009 void
00010 BCP_pack_warmstart(const BCP_warmstart* ws, BCP_buffer& buf)
00011 {
00012    const BCP_warmstart_basis* wsb =
00013       dynamic_cast<const BCP_warmstart_basis*>(ws);
00014    if (wsb) {
00015       const int type = 1;
00016       buf.pack(type);
00017       wsb->pack(buf);
00018       return;
00019    }
00020 
00021    const BCP_warmstart_dual* wsd =
00022       dynamic_cast<const BCP_warmstart_dual*>(ws);
00023    if (wsd) {
00024       const int type = 2;
00025       buf.pack(type);
00026       wsd->pack(buf);
00027       return;
00028    }
00029 
00030    const int type = 0;
00031    buf.pack(type);
00032 }
00033 
00034 BCP_warmstart*
00035 BCP_unpack_warmstart(BCP_buffer& buf)
00036 {
00037    int type;
00038    buf.unpack(type);
00039    switch (type) {
00040    case 0: return 0;
00041    case 1: return new BCP_warmstart_basis(buf);
00042    case 2: return new BCP_warmstart_dual(buf);
00043    default:
00044       throw BCP_fatal_error("Unknown warmstart in BCP_unpack_warmstart.\n");
00045    }
00046    return 0;
00047 }

Generated on Wed Dec 3 14:32:35 2003 for BCP by doxygen 1.3.5