+
+Context*
+Context::create_context (Context_def * cdef,
+ String id,
+ SCM ops)
+{
+ String type = ly_symbol2string (cdef->get_context_name());
+ Object_key const *key = get_context_key (type, id);
+ Context * new_group
+ = cdef->instantiate (ops, key);
+
+ new_group->id_string_ = id;
+ add_context (new_group);
+ apply_property_operations (new_group, ops);
+
+ return new_group;
+}
+
+
+
+Object_key const*
+Context::get_context_key (String type, String id)
+{
+ String now_key = type + "@" + id;
+
+ int disambiguation_count = 0;
+ if (context_counts_.find (now_key) != context_counts_.end ())
+ {
+ disambiguation_count = context_counts_[now_key];
+ }
+
+ context_counts_[now_key] = disambiguation_count + 1;
+
+
+ return new Lilypond_context_key (get_key (),
+ now_mom(),
+ type, id,
+ disambiguation_count);
+}
+
+Object_key const*
+Context::get_grob_key (String name)
+{
+ int disambiguation_count = 0;
+ if (grob_counts_.find (name) != grob_counts_.end ())
+ {
+ disambiguation_count = grob_counts_[name];
+ }
+ grob_counts_[name] = disambiguation_count + 1;
+
+ Object_key * k = new Lilypond_grob_key (get_key(),
+ now_mom(),
+ name,
+ disambiguation_count);
+
+ return k;
+}
+
+
+