Scope::~Scope ()
{
- delete id_dict_;
+ scm_unprotect_object (id_dict_->self_scm ());
}
Scope::Scope (Scope const&s)
- : id_dict_ (new Scheme_hash_table (*s.id_dict_))
{
- /*
- cloning not necessary.
-
- id_dict_ = new Hash_table<Protected_scm,Identifier*> (*s.id_dict_);
- for (Scope_iter ai (s); ai.ok(); ai++)
- {
- id_dict_->elem (ai.scm_key ()) = ai.val ()->clone ();
- }
- */
+ id_dict_ =new Scheme_hash_table (*s.id_dict_);
}
Scope::Scope ()
{
return unsmob_identifier (id_dict_->get (s));
}
+
+SCM
+Scope::scm_elem (SCM s)const
+{
+ return id_dict_->get (s);
+}
+
+SCM
+Scope::scm_elem (String s) const
+{
+ return scm_elem (ly_symbol2scm (s.ch_C()));
+}
+
Identifier*
Scope::elem (String s)const
{
return elem (ly_symbol2scm (s.ch_C()));
}
+void
+Scope::set (String s, SCM id)
+{
+ return id_dict_->set (ly_symbol2scm (s.ch_C()), id);
+}
+
void
Scope::set (String s, Identifier * id)
{
- return id_dict_->set (ly_symbol2scm (s.ch_C()), smobify (id));
+ return id_dict_->set (ly_symbol2scm (s.ch_C()), id->self_scm ());
}
SCM
{
return id_dict_->to_alist ();
}
+
+bool
+Scope::try_retrieve (SCM k , SCM *v)const
+{
+ return id_dict_->try_retrieve (k, v);
+}
+