Fresco/Berlin/modules/Primitives PrimitiveKitImpl.cc,1.8,1.9

Tobias Hunger <[email protected]>
Newsgroups gmane.comp.video.fresco.cvs
Message-ID <[email protected]>
Update of /cvs/fresco/Fresco/Berlin/modules/Primitives
In directory purcel:/tmp/cvs-serv9995/Berlin/modules/Primitives

Modified Files:
	PrimitiveKitImpl.cc 
Log Message:
Cleanup the cleanup.

A new template create_and_set_body added to KitImpl. That gets us around the
need to define a temporary in most places, shortening the code even further.


Index: PrimitiveKitImpl.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Primitives/PrimitiveKitImpl.cc,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- PrimitiveKitImpl.cc	23 Jan 2003 22:31:05 -0000	1.8
+++ PrimitiveKitImpl.cc	25 Jan 2003 22:37:02 -0000	1.9
@@ -40,12 +40,10 @@
 
 Graphic_ptr PrimitiveKitImpl::root(Graphic_ptr g)
 {
-  Graphic_ptr res =
-      create<Graphic>(new Root(Alignment(0.5), Alignment(0.5),
-			       Alignment(0.5), Alignment(0.5),
-			       Alignment(0.5), Alignment(0.5)));
-  res->body(g);
-  return res;
+    return create_and_set_body<Graphic>(
+	new Root(Alignment(0.5), Alignment(0.5),
+		 Alignment(0.5), Alignment(0.5),
+		 Alignment(0.5), Alignment(0.5)), g);
 }
 
 Primitive::Geometry_ptr PrimitiveKitImpl::geometry(const Fresco::Mesh &mesh)
@@ -108,9 +106,7 @@
 
 Graphic_ptr PrimitiveKitImpl::transformer(Graphic_ptr g)
 {
-  Graphic_ptr res = create<Graphic>(new Transformer);
-  res->body(g);
-  return res;
+  return create_and_set_body<Graphic>(new Transformer, g);
 }
 
 Graphic_ptr PrimitiveKitImpl::directional_light(Fresco::Graphic_ptr g,
@@ -118,9 +114,7 @@
 						CORBA::Float i,
 						const Fresco::Vertex &d)
 {
-  Graphic_ptr res = create<Graphic>(new DirectionalLight(c, i, d));
-  res->body(g);
-  return res;
+  return create_and_set_body<Graphic>(new DirectionalLight(c, i, d), g);
 }
 
 Graphic_ptr PrimitiveKitImpl::point_light(Fresco::Graphic_ptr g,
@@ -128,9 +122,7 @@
 					  CORBA::Float i,
 					  const Fresco::Vertex &p)
 {
-  Graphic_ptr res = create<Graphic>(new PointLight(c, i, p));
-  res->body(g);
-  return res;
+  return create_and_set_body<Graphic>(new PointLight(c, i, p), g);
 }
 
 Graphic_ptr PrimitiveKitImpl::spot_light(Fresco::Graphic_ptr g,
@@ -141,9 +133,7 @@
 					 CORBA::Float r,
 					 CORBA::Float a)
 {
-  Graphic_ptr res = create<Graphic>(new SpotLight(c, i, p, d, r, a));
-  res->body(g);
-  return res;
+  return create_and_set_body<Graphic>(new SpotLight(c, i, p, d, r, a), g);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.