OpenASIP  2.0
EditPolicy.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file EditPolicy.hh
26  *
27  * Declaration of EditPolicy class.
28  *
29  * @author Ari Metsähalme 2003 (ari.metsahalme-no.spam-tut.fi)
30  * @note rating: yellow
31  * @note reviewed Jul 20 2004 by vpj, jn, am
32  */
33 
34 #ifndef TTA_EDIT_POLICY_HH
35 #define TTA_EDIT_POLICY_HH
36 
37 class EditPart;
38 class Request;
39 class ComponentCommand;
40 
41 /**
42  * Determines how an EditPart acts when a Request is performed on it.
43  *
44  * Converts a given Request to a Command if the EditPolicy supports
45  * the Request.
46  */
47 class EditPolicy {
48 public:
49  EditPolicy();
50  virtual ~EditPolicy();
51 
52  EditPart* host() const;
53  void setHost(EditPart* host);
54 
55  /**
56  * Returns the Command corresponding to the type of the Request.
57  *
58  * @param request Request to be handled.
59  * @return NULL if the Request cannot be handled.
60  */
61  virtual ComponentCommand* getCommand(Request* request) = 0;
62 
63  /**
64  * Tells whether this EditPolicy is able to handle a certain type
65  * of Request.
66  *
67  * @param request Request to be asked if it can be handled.
68  * @return True if the Request can be handled, false otherwise.
69  */
70  virtual bool canHandle(Request* request) const = 0;
71 
72 protected:
73  /// Host EditPart of this EditPolicy.
75 
76 private:
77  /// Assignment not allowed.
79  /// Copying not allowed.
80  EditPolicy(EditPolicy& old);
81 };
82 
83 #include "EditPolicy.icc"
84 
85 #endif
EditPolicy::host
EditPart * host() const
EditPolicy::setHost
void setHost(EditPart *host)
EditPolicy::~EditPolicy
virtual ~EditPolicy()
Definition: EditPolicy.cc:47
EditPolicy::host_
EditPart * host_
Host EditPart of this EditPolicy.
Definition: EditPolicy.hh:74
EditPolicy::getCommand
virtual ComponentCommand * getCommand(Request *request)=0
EditPolicy::EditPolicy
EditPolicy()
Definition: EditPolicy.cc:41
EditPolicy::operator=
EditPolicy & operator=(EditPolicy &old)
Assignment not allowed.
EditPolicy
Definition: EditPolicy.hh:47
EditPart
Definition: EditPart.hh:60
EditPolicy::canHandle
virtual bool canHandle(Request *request) const =0
Request
Definition: Request.hh:43
ComponentCommand
Definition: ComponentCommand.hh:46
EditPolicy.icc