Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tiger
nolimips
Commits
39afac5e
Commit
39afac5e
authored
Jul 07, 2003
by
Benoit Perrot
Browse files
label.hh, label.cc: populate.
parent
006a4166
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/inst/label.cc
0 → 100644
View file @
39afac5e
//
// This file is part of Mipsy, a tiny MIPS simulator
// Copyright (C) 2003 Benoit Perrot <benoit@lrde.epita.fr>
//
// Mipsy is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Mipsy is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
#include "inst/label.hh"
namespace
inst
{
Label
::
string_set_t
Label
::
_set
;
}
// namespace inst
src/inst/label.hh
0 → 100644
View file @
39afac5e
//
// This file is part of Mipsy, a tiny MIPS simulator
// Copyright (C) 2003 Benoit Perrot <benoit@lrde.epita.fr>
//
// Mipsy is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Mipsy is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
#ifndef INST_LABEL_HH
# define INST_LABEL_HH
# include <set>
# include <string>
# include <iostream>
namespace
inst
{
class
Label
{
typedef
std
::
set
<
std
::
string
>
string_set_t
;
typedef
string_set_t
::
size_type
size_type
;
public:
explicit
Label
(
const
std
::
string
&
s
)
:
_set_node
(
_set
.
insert
(
s
).
first
)
{
}
public:
const
std
::
string
&
get_name
()
const
{
return
*
_set_node
;
}
public:
static
size_type
map_size
()
{
return
_set
.
size
();
}
public:
bool
operator
==
(
const
Label
&
rhs
)
const
{
return
_set_node
==
rhs
.
_set_node
;
}
bool
operator
!=
(
const
Label
&
rhs
)
const
{
return
!
this
->
operator
==
(
rhs
);
}
bool
operator
<
(
const
Label
&
rhs
)
const
{
return
&
this
->
get_name
()
<
&
rhs
.
get_name
();
}
private:
static
string_set_t
_set
;
const
string_set_t
::
const_iterator
_set_node
;
};
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
ostr
,
const
Label
&
l
)
{
return
ostr
<<
l
.
get_name
();
}
}
// namespace inst
#endif // !INST_LABEL_HH
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment