~ubuntu-branches/debian/experimental/ncbi-tools6/experimental

« back to all changes in this revision

Viewing changes to algo/blast/core/gencode_singleton.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2008-07-14 19:43:15 UTC
  • mfrom: (2.1.12 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080714194315-ed44u9ek7txva2rz
Tags: 6.1.20080302-3
tools/readdb.c: enable madvise()-based code on all glibc (hence all
Debian) systems, not just Linux.  (Closes: #490437.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  $Id: gencode_singleton.c,v 1.3 2007/03/20 14:55:38 kazimird Exp $
 
2
 * ===========================================================================
 
3
 *
 
4
 *                            PUBLIC DOMAIN NOTICE
 
5
 *               National Center for Biotechnology Information
 
6
 *
 
7
 *  This software/database is a "United States Government Work" under the
 
8
 *  terms of the United States Copyright Act.  It was written as part of
 
9
 *  the author's official duties as a United States Government employee and
 
10
 *  thus cannot be copyrighted.  This software/database is freely available
 
11
 *  to the public for use. The National Library of Medicine and the U.S.
 
12
 *  Government have not placed any restriction on its use or reproduction.
 
13
 *
 
14
 *  Although all reasonable efforts have been taken to ensure the accuracy
 
15
 *  and reliability of the software and data, the NLM and the U.S.
 
16
 *  Government do not and cannot warrant the performance or results that
 
17
 *  may be obtained by using this software or data. The NLM and the U.S.
 
18
 *  Government disclaim all warranties, express or implied, including
 
19
 *  warranties of performance, merchantability or fitness for any particular
 
20
 *  purpose.
 
21
 *
 
22
 *  Please cite the author in any work or product based on this material.
 
23
 *
 
24
 * ===========================================================================
 
25
 *
 
26
 * Author: Christiam Camacho
 
27
 *
 
28
 */
 
29
 
 
30
/** @file gencode_singleton.c
 
31
 * Implementation of the genetic code singleton
 
32
 */
 
33
 
 
34
#ifndef SKIP_DOXYGEN_PROCESSING
 
35
static char const rcsid[] = 
 
36
    "$Id: gencode_singleton.c,v 1.3 2007/03/20 14:55:38 kazimird Exp $";
 
37
#endif /* SKIP_DOXYGEN_PROCESSING */
 
38
 
 
39
#include <algo/blast/core/gencode_singleton.h>
 
40
#include "blast_dynarray.h"
 
41
 
 
42
/** The singleton instance */
 
43
static SDynamicSGenCodeNodeArray* g_theInstance = NULL;
 
44
 
 
45
void
 
46
GenCodeSingletonInit()
 
47
{
 
48
    if (g_theInstance == NULL) {
 
49
        g_theInstance = DynamicSGenCodeNodeArrayNew();
 
50
    }
 
51
    ASSERT(g_theInstance);
 
52
}
 
53
 
 
54
void
 
55
GenCodeSingletonFini()
 
56
{
 
57
    g_theInstance = DynamicSGenCodeNodeArrayFree(g_theInstance);
 
58
}
 
59
 
 
60
Int2
 
61
GenCodeSingletonAdd(Uint4 gen_code_id, const Uint1* gen_code_str)
 
62
{
 
63
    SGenCodeNode node;
 
64
    node.gc_id = gen_code_id;
 
65
    node.gc_str = (Uint1*)gen_code_str;
 
66
    ASSERT(g_theInstance);
 
67
    return DynamicSGenCodeNodeArray_Append(g_theInstance, node);
 
68
}
 
69
 
 
70
Uint1*
 
71
GenCodeSingletonFind(Uint4 gen_code_id)
 
72
{
 
73
    ASSERT(g_theInstance);
 
74
    return DynamicSGenCodeNodeArray_Find(g_theInstance, gen_code_id);
 
75
}