Arcane  4.2.1.0
User documentation
Loading...
Searching...
No Matches
Collection.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* Collection.cc (C) 2000-2026 */
9/* */
10/* Base class of a collection. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arccore/common/Collection.h"
15
16#include "arccore/base/ArgumentException.h"
17#include "arccore/base/TraceInfo.h"
18
19// These files are not directly used here but allow
20// exporting the symbols.
21#include "arccore/common/List.h"
22
23#include <iostream>
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28namespace Arcane
29{
30
31namespace
32{
33 void _doNoReferenceError(const void* ptr)
34 {
35 std::cerr << "** FATAL: Null reference.\n";
36 std::cerr << "** FATAL: Trying to use an item not referenced.\n";
37 std::cerr << "** FATAL: Item is located at memory address " << ptr << ".\n";
38 arccoreDebugPause("arcaneNoReferenceError");
39 }
40} // namespace
41
42/*---------------------------------------------------------------------------*/
43/*---------------------------------------------------------------------------*/
44
45void ObjectImpl::
46_noReferenceErrorCallTerminate(const void* ptr)
47{
48 _doNoReferenceError(ptr);
49 std::terminate();
50}
51
52/*---------------------------------------------------------------------------*/
53/*---------------------------------------------------------------------------*/
54
55extern "C" ARCCORE_COMMON_EXPORT void
56throwOutOfRangeException()
57{
58 std::cerr << "** FATAL: Invalid access on a collection (array, list, ...).\n";
59 throw ArgumentException(A_FUNCINFO, "Bad index");
60}
61
62/*---------------------------------------------------------------------------*/
63/*---------------------------------------------------------------------------*/
64
65} // namespace Arcane
66
67/*---------------------------------------------------------------------------*/
68/*---------------------------------------------------------------------------*/
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
void arccoreDebugPause(const char *msg)
Enters pause mode or throws a fatal error.