Geant4_10
G4GIDI_map.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 /*
27 # <<BEGIN-copyright>>
28 # Copyright (c) 2010, Lawrence Livermore National Security, LLC.
29 # Produced at the Lawrence Livermore National Laboratory
30 # Written by Bret R. Beck, beck6@llnl.gov.
31 # CODE-461393
32 # All rights reserved.
33 #
34 # This file is part of GIDI. For details, see nuclear.llnl.gov.
35 # Please also read the "Additional BSD Notice" at nuclear.llnl.gov.
36 #
37 # Redistribution and use in source and binary forms, with or without modification,
38 # are permitted provided that the following conditions are met:
39 #
40 # 1) Redistributions of source code must retain the above copyright notice,
41 # this list of conditions and the disclaimer below.
42 # 2) Redistributions in binary form must reproduce the above copyright notice,
43 # this list of conditions and the disclaimer (as noted below) in the
44 # documentation and/or other materials provided with the distribution.
45 # 3) Neither the name of the LLNS/LLNL nor the names of its contributors may be
46 # used to endorse or promote products derived from this software without
47 # specific prior written permission.
48 #
49 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
50 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
51 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
52 # SHALL LAWRENCE LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR
53 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
54 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
56 # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
57 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
58 # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59 # <<END-copyright>>
60 */
61 
62 #include "G4GIDI_map.hh"
63 
64 using namespace std;
65 using namespace GIDI;
66 
67 /*
68 ***************************************************************
69 */
70 G4GIDI_map::G4GIDI_map( string &dataDirectory ) {
71 
72  smr_initialize( &smr );
73  map = tpia_map_readFile( &smr, NULL, dataDirectory.c_str( ) );
74  if( !smr_isOk( &smr ) ) {
75  smr_print( &smr, stderr, 1 );
76  throw 1;
77  }
78 }
79 /*
80 ***************************************************************
81 */
83 
84  if( map != NULL ) tpia_map_free( NULL, map );
85  smr_release( &smr );
86 }
87 /*
88 ***************************************************************
89 */
90 string G4GIDI_map::fileName( void ) {
91 
92  return( map->mapFileName );
93 }
94 /*
95 ***************************************************************
96 */
97 string G4GIDI_map::path( void ) {
98 
99  return( map->path );
100 }
void smr_print(statusMessageReporting *smr, FILE *f, int clear)
int smr_release(statusMessageReporting *smr)
tpia_map * tpia_map_readFile(statusMessageReporting *smr, const char *basePath, const char *mapFileName)
Definition: tpia_map.cc:88
std::string fileName(void)
Definition: G4GIDI_map.cc:90
void * tpia_map_free(statusMessageReporting *smr, tpia_map *map)
Definition: tpia_map.cc:184
int smr_isOk(statusMessageReporting *smr)
int smr_initialize(statusMessageReporting *smr)
std::string path(void)
Definition: G4GIDI_map.cc:97
G4GIDI_map(std::string &dataDirectory)
Definition: G4GIDI_map.cc:70