LCOV - code coverage report
Current view: top level - libs/common - instanceof.hpp (source / functions) Hit Total Coverage
Test: coverage_cleared.info Lines: 1 1 100.0 %
Date: 2018-12-05 17:11:35 Functions: 25 25 100.0 %

          Line data    Source code
       1             : /**
       2             :  * Copyright Soramitsu Co., Ltd. All Rights Reserved.
       3             :  * SPDX-License-Identifier: Apache-2.0
       4             :  */
       5             : 
       6             : #ifndef IROHA_COMMON_INSTANCEOF_HPP
       7             : #define IROHA_COMMON_INSTANCEOF_HPP
       8             : 
       9             : #include <typeinfo>
      10             : 
      11             : // check the type of the derived class
      12             : template <typename Base, typename T>
      13             : inline bool instanceof (const T *ptr) {
      14             :   return typeid(Base) == typeid(*ptr);
      15             : }
      16             : 
      17             : template <typename Base, typename T>
      18             : inline bool instanceof (const T &ptr) {
      19         105 :   return typeid(Base) == typeid(ptr);
      20             : }
      21             : 
      22             : #endif  // IROHA_COMMON_INSTANCEOF_HPP

Generated by: LCOV version 1.13