Giter Site home page Giter Site logo

large data generating. about ctemplate HOT 9 CLOSED

olafvdspek avatar olafvdspek commented on July 22, 2024
large data generating.

from ctemplate.

Comments (9)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
I would prefer to see a callback to render rather than an in-place
substitution/expansion, personally.  It would be more flexible than in-place
substitution.  Your request would be accomplished by handing it a callback that
appends to a file.

Original comment by [email protected] on 5 Feb 2009 at 12:18

from ctemplate.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
Thanks, Foster,
But is there any callback hooking mechanism in current version? could you please
describe it in more detail ?

thanks very much!

Original comment by [email protected] on 5 Feb 2009 at 5:46

from ctemplate.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
There is no such callback that I am aware of, I was simply trying to add to the
discussion.  In-place expansion seems fairly unlikely, as the templates are 
(ideally)
cached and not read from disk during expansion/render.

So again, this doesn't exist, I was just suggesting an alternative feature that 
would
satisfy your requirements and others.

Original comment by [email protected] on 5 Feb 2009 at 11:24

from ctemplate.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
Issue 29 has been merged into this issue.

Original comment by [email protected] on 6 Feb 2009 at 2:28

from ctemplate.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
There are a couple of points here:

As to the fact that adding 10M to the template dictionary requires copying 10M 
of
data -- which takes time and space -- I don't disagree.  It would be nice to 
allow
"pointers" to data elsewhere, but it's hard to guarantee data lifetimes,
thread-safety, etc.  I'm not sure the best way to resolve this.

As for writing the template expansion directly to disk rather than to a string, 
it's
not supported now, but is easy to add to the code.  We'd just define a version 
of
Expand() in template.h that takes a FILE* (or whatever) rather than a string.  
Then
you'd have to define a new version of Expand() in template.cc that know how to 
write
to a file.  Internally template.cc uses the concept of an ExpandEmitter; all 
you'll
need to do is define an ExpandEmitter that works on FILE*.

It might make sense to expose ExpandEmitter, to make it easier for folks to 
Expand to
other data sinks of their own devising; kinda like we do with TemplateString for
input.  But hopefully modifying the source code yourself directly should work 
well
for your needs.

Original comment by [email protected] on 6 Feb 2009 at 2:39

  • Changed state: Accepted
  • Added labels: Type-Enhancement, Priority-Medium

from ctemplate.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
thanks very much, that's a good idea.

Original comment by [email protected] on 6 Feb 2009 at 2:24

from ctemplate.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
I read around the template.h/cc, and tried to add a new expand(). for my 
specific
purpose at this time, it should be enough, but I don't think it's a good idea 
to add
a new expand() in lib file template.h and recompile the lib, each time when a 
new
type of stream sink is needed, I really hope I could just inherit from the class
Template or use template specializing to define my specific Template class, in 
this
way, it could be more expandable. 
for example:
Template<MyEmitter> tpl =  Template<MyEmitter>::GetTemplate(...);

Have a good day ...




Original comment by [email protected] on 6 Feb 2009 at 8:21

from ctemplate.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
In the next version, it will be possible for you to write your own 
TemplateEmitter
and call Template::Expand(&your_emitter, ...).

Original comment by [email protected] on 10 Feb 2009 at 7:04

  • Changed state: Started

from ctemplate.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
This has been added to ctemplate 0.94, just released.

Original comment by [email protected] on 7 May 2009 at 3:35

  • Changed state: Fixed

from ctemplate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.