handle.hpp
Go to the documentation of this file.
1 /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 /*
4  Copyright (C) 2006, 2007 Eric Ehlers
5 
6  This file is part of QuantLib, a free-software/open-source library
7  for financial quantitative analysts and developers - http://quantlib.org/
8 
9  QuantLib is free software: you can redistribute it and/or modify it
10  under the terms of the QuantLib license. You should have received a
11  copy of the license along with this program; if not, please email
12  <quantlib-dev@lists.sf.net>. The license is also available online at
13  <http://quantlib.org/license.shtml>.
14 
15  This program is distributed in the hope that it will be useful, but WITHOUT
16  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  FOR A PARTICULAR PURPOSE. See the license for more details.
18 */
19 
20 #ifndef qla_handle_hpp
21 #define qla_handle_hpp
22 
23 #include <oh/object.hpp>
24 
25 namespace QuantLibAddin {
26 
27  class Handle : public ObjectHandler::Object {
28  public:
29  std::string currentLink() const {
30  return boost::get<std::string>(propertyValue("CURRENTLINK"));
31  }
32  virtual bool empty() const = 0;
33  protected:
34  Handle(const boost::shared_ptr<ObjectHandler::ValueObject> &properties,
35  const std::string &objectId,
36  bool permanent) : ObjectHandler::Object(properties, permanent) {}
37  };
38 
39  class RelinkableHandle : public Handle {
40  public:
41  virtual void linkTo(const std::string &objectID) = 0;
42  protected:
43  RelinkableHandle(const boost::shared_ptr<ObjectHandler::ValueObject> &properties,
44  const std::string &objectId,
45  bool permanent) : Handle(properties, objectId, permanent) {}
46  };
47 
48 }
49 
50 #endif
51 
Definition: handle.hpp:39
virtual void linkTo(const std::string &objectID)=0
RelinkableHandle(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const std::string &objectId, bool permanent)
Definition: handle.hpp:43
Definition: abcd.hpp:38
std::string currentLink() const
Definition: handle.hpp:29
Handle(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const std::string &objectId, bool permanent)
Definition: handle.hpp:34
Definition: handle.hpp:27
virtual bool empty() const =0