IDL compiler front-end library
Array.h
Go to the documentation of this file.
1 /*
3 * Nirvana IDL front-end library.
4 *
5 * This is a part of the Nirvana project.
6 *
7 * Author: Igor Popov
8 *
9 * Copyright (c) 2021 Igor Popov.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
23 *
24 * Send comments and/or bug reports to:
25 * popov.nirvana@gmail.com
26 */
27 #ifndef IDLFE_AST_ARRAY_H_
28 #define IDLFE_AST_ARRAY_H_
29 #pragma once
30 
31 #include "Type.h"
32 #include <vector>
33 
34 namespace AST {
35 
37 class Array :
38  public Type
39 {
40 public:
42  const std::vector <Dim>& dimensions () const noexcept
43  {
44  return dimensions_;
45  }
46 
48  bool operator == (const Array& rhs) const noexcept
49  {
50  return Type::operator == (rhs) && dimensions () == rhs.dimensions ();
51  }
52 
53 private:
54  friend class Type;
55 
56  Array (const Type& type, std::vector <Dim>&& dimensions) :
57  Type (type),
58  dimensions_ (std::move (dimensions))
59  {}
60 
61 private:
62  std::vector <Dim> dimensions_;
63 };
64 
65 }
66 
67 #endif
The array type descriptor.
Definition: Array.h:39
bool operator==(const Array &rhs) const noexcept
Check types for equality.
Definition: Array.h:48
const std::vector< Dim > & dimensions() const noexcept
Definition: Array.h:42
An IDL type.
Definition: Type.h:47
bool operator==(const Type &rhs) const noexcept
Check types for equality.
Abstract Syntax Tree namespace.
Definition: Array.h:34