1
/* $Id: gencode_singleton.c,v 1.3 2007/03/20 14:55:38 kazimird Exp $
2
* ===========================================================================
5
* National Center for Biotechnology Information
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.
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
22
* Please cite the author in any work or product based on this material.
24
* ===========================================================================
26
* Author: Christiam Camacho
30
/** @file gencode_singleton.c
31
* Implementation of the genetic code singleton
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 */
39
#include <algo/blast/core/gencode_singleton.h>
40
#include "blast_dynarray.h"
42
/** The singleton instance */
43
static SDynamicSGenCodeNodeArray* g_theInstance = NULL;
46
GenCodeSingletonInit()
48
if (g_theInstance == NULL) {
49
g_theInstance = DynamicSGenCodeNodeArrayNew();
51
ASSERT(g_theInstance);
55
GenCodeSingletonFini()
57
g_theInstance = DynamicSGenCodeNodeArrayFree(g_theInstance);
61
GenCodeSingletonAdd(Uint4 gen_code_id, const Uint1* gen_code_str)
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);
71
GenCodeSingletonFind(Uint4 gen_code_id)
73
ASSERT(g_theInstance);
74
return DynamicSGenCodeNodeArray_Find(g_theInstance, gen_code_id);