LCOV - code coverage report
Current view: top level - nsas - fetchable.h (source / functions) Hit Total Coverage
Test: report.info Lines: 3 3 100.0 %
Date: 2012-05-15 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // Copyright (C) 2010  Internet Systems Consortium, Inc. ("ISC")
       2                 :            : //
       3                 :            : // Permission to use, copy, modify, and/or distribute this software for any
       4                 :            : // purpose with or without fee is hereby granted, provided that the above
       5                 :            : // copyright notice and this permission notice appear in all copies.
       6                 :            : //
       7                 :            : // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
       8                 :            : // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
       9                 :            : // AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
      10                 :            : // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
      11                 :            : // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
      12                 :            : // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
      13                 :            : // PERFORMANCE OF THIS SOFTWARE.
      14                 :            : 
      15                 :            : #ifndef __FETCHABLE_H
      16                 :            : #define __FETCHABLE_H
      17                 :            : 
      18                 :            : /**
      19                 :            :  * \file fetchable.h
      20                 :            :  * \short Interface of information that can be fetched.
      21                 :            :  */
      22                 :            : 
      23                 :            : namespace isc {
      24                 :            : namespace nsas {
      25                 :            : 
      26                 :            : /**
      27                 :            :  * \short Interface of information that can be fetched.
      28                 :            :  *
      29                 :            :  * This just holds a state of information that can be fetched from somewhere.
      30                 :            :  * No locking is performed, if it is desirable, it should be locked manually.
      31                 :            :  */
      32                 :            : class Fetchable {
      33                 :            :     public:
      34                 :            :         /// \short States the Fetchable object can be in.
      35                 :            :         enum State {
      36                 :            :             /// \short No one yet asked for the information.
      37                 :            :             NOT_ASKED,
      38                 :            :             /// \short The information is too old and should not be used.
      39                 :            :             EXPIRED,
      40                 :            :             /// \short The information is asked for but it did not arrive.
      41                 :            :             IN_PROGRESS,
      42                 :            :             /// \short It is not possible to get the information.
      43                 :            :             UNREACHABLE,
      44                 :            :             /// \short The information is already present.
      45                 :            :             READY
      46                 :            :         };
      47                 :            :         /// \short Constructors
      48                 :            :         //@{
      49                 :            :         /// This creates the Fetchable object in the given state.
      50                 :            :         Fetchable(State state = NOT_ASKED) :
      51                 :        206 :             state_(state)
      52                 :            :         { }
      53                 :            :         //@}
      54                 :            :         /// \short Getter and setter of current state.
      55                 :            :         //@{
      56                 :    2410422 :         State getState() const { return state_; }
      57                 :        114 :         void setState(State state) { state_ = state; }
      58                 :            :         //@}
      59                 :            :     private:
      60                 :            :         State state_;
      61                 :            : };
      62                 :            : 
      63                 :            : } // namespace nsas
      64                 :            : } // namespace isc
      65                 :            : 
      66                 :            : #endif // __FETCHABLE_H

Generated by: LCOV version 1.9