1 /*===========================================================================
2 *
3 *                            PUBLIC DOMAIN NOTICE
4 *               National Center for Biotechnology Information
5 *
6 *  This software/database is a "United States Government Work" under the
7 *  terms of the United States Copyright Act.  It was written as part of
8 *  the author's official duties as a United States Government employee and
9 *  thus cannot be copyrighted.  This software/database is freely available
10 *  to the public for use. The National Library of Medicine and the U.S.
11 *  Government have not placed any restriction on its use or reproduction.
12 *
13 *  Although all reasonable efforts have been taken to ensure the accuracy
14 *  and reliability of the software and data, the NLM and the U.S.
15 *  Government do not and cannot warrant the performance or results that
16 *  may be obtained by using this software or data. The NLM and the U.S.
17 *  Government disclaim all warranties, express or implied, including
18 *  warranties of performance, merchantability or fitness for any particular
19 *  purpose.
20 *
21 *  Please cite the author in any work or product based on this material.
22 *
23 * ===========================================================================
24 *
25 */
26 
27 #ifndef _hpp_ngs_adapt_readitf_
28 #define _hpp_ngs_adapt_readitf_
29 
30 #ifndef _hpp_ngs_adapt_fragmentitf_
31 #include <ngs/adapter/FragmentItf.hpp>
32 #endif
33 
34 #ifndef _h_ngs_itf_readitf_
35 #include <ngs/itf/ReadItf.h>
36 #endif
37 
38 namespace ngs_adapt
39 {
40 
41     /*----------------------------------------------------------------------
42      * forwards
43      */
44     class StringItf;
45 
46     /*----------------------------------------------------------------------
47      * ReadItf
48      */
49     class ReadItf : public FragmentItf
50     {
51     public:
52 
53         virtual StringItf * getReadId () const = 0;
54         virtual uint32_t getNumFragments () const = 0;
55         virtual uint32_t getReadCategory () const = 0;
56         virtual StringItf * getReadGroup () const = 0;
57         virtual StringItf * getReadName () const = 0;
58         virtual StringItf * getReadBases ( uint64_t offset, uint64_t length ) const = 0;
59         virtual StringItf * getReadQualities ( uint64_t offset, uint64_t length ) const = 0;
60         virtual bool nextRead () = 0;
61 
Cast()62         inline NGS_Read_v1 * Cast ()
63         { return static_cast < NGS_Read_v1* > ( OpaqueRefcount :: offset_this () ); }
64 
Cast() const65         inline const NGS_Read_v1 * Cast () const
66         { return static_cast < const NGS_Read_v1* > ( OpaqueRefcount :: offset_this () ); }
67 
68         // assistance for C objects
Self(NGS_Read_v1 * obj)69         static inline ReadItf * Self ( NGS_Read_v1 * obj )
70         { return static_cast < ReadItf* > ( OpaqueRefcount :: offset_cobj ( obj ) ); }
71 
Self(const NGS_Read_v1 * obj)72         static inline const ReadItf * Self ( const NGS_Read_v1 * obj )
73         { return static_cast < const ReadItf* > ( OpaqueRefcount :: offset_cobj ( obj ) ); }
74 
75     protected:
76 
77         ReadItf ();
78         static NGS_Read_v1_vt ivt;
79 
80     private:
81 
82         static NGS_String_v1 * CC get_id ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
83         static uint32_t CC get_num_frags ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
84         static uint32_t CC get_category ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
85         static NGS_String_v1 * CC get_read_group ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
86         static NGS_String_v1 * CC get_name ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
87         static NGS_String_v1 * CC get_bases ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err, uint64_t offset, uint64_t length );
88         static NGS_String_v1 * CC get_quals ( const NGS_Read_v1 * self, NGS_ErrBlock_v1 * err, uint64_t offset, uint64_t length );
89         static bool CC next ( NGS_Read_v1 * self, NGS_ErrBlock_v1 * err );
90 
91     };
92 
93 } // namespace ngs_adapt
94 
95 #endif // _hpp_ngs_adapt_readitf_
96