size_t RandomNumberStore::TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel, bool blocking)
{
	if (!blocking)
		throw NotImplemented("RandomNumberStore: nonblocking transfer is not implemented by this object");

	transferBytes = UnsignedMin(transferBytes, m_length - m_count);
	m_rng->GenerateIntoBufferedTransformation(target, channel, transferBytes);
	m_count += transferBytes;

	return 0;
}
Example #2
0
void RandomNumberGenerator::GenerateBlock(byte *output, size_t size)
{
	CRYPTOPP_UNUSED(output), CRYPTOPP_UNUSED(size);

#if 0
	// This breaks AutoSeededX917RNG<T> generators.
	throw NotImplemented("RandomNumberGenerator: GenerateBlock not implemented");
#endif

	ArraySink s(output, size);
	GenerateIntoBufferedTransformation(s, DEFAULT_CHANNEL, size);
}
Example #3
0
Real3 MeshSurface::draw_position(boost::shared_ptr<RandomNumberGenerator>& rng) const
{
#ifdef HAVE_VTK
    vtkPolyData* polydata = reader_->GetOutput();
    std::vector<double> areas(polydata->GetNumberOfCells());
    for (vtkIdType i(0); i < polydata->GetNumberOfCells(); i++)
    {
        vtkCell* cell = polydata->GetCell(i);
        vtkTriangle* triangle = dynamic_cast<vtkTriangle*>(cell);
        double p0[3];
        double p1[3];
        double p2[3];
        triangle->GetPoints()->GetPoint(0, p0);
        triangle->GetPoints()->GetPoint(1, p1);
        triangle->GetPoints()->GetPoint(2, p2);
        const double area = vtkTriangle::TriangleArea(p0, p1, p2);
        // std::cout << "p0: " << p0[0] << " " << p0[1] << " " << p0[2] << std::endl;
        // std::cout << "p1: " << p1[0] << " " << p1[1] << " " << p1[2] << std::endl;
        // std::cout << "p2: " << p2[0] << " " << p2[1] << " " << p2[2] << std::endl;
        // std::cout << "area of triangle " << i << ": " << area << std::endl;
        areas[i] = area;
    }
    const double rnd = rng->uniform(0.0, std::accumulate(areas.begin(), areas.end(), 0.0));
    double totarea = 0.0;
    for (vtkIdType i(0); i < polydata->GetNumberOfCells(); i++)
    {
        totarea += areas[i];
        if (rnd < totarea)
        {
            vtkCell* cell = polydata->GetCell(i);
            vtkTriangle* triangle = dynamic_cast<vtkTriangle*>(cell);
            double p0[3];
            double p1[3];
            double p2[3];
            triangle->GetPoints()->GetPoint(0, p0);
            triangle->GetPoints()->GetPoint(1, p1);
            triangle->GetPoints()->GetPoint(2, p2);
            const Real3 P0(p0[0], p0[1], p0[2]);
            const Real3 P1(p1[0], p1[1], p1[2]);
            const Real3 P2(p2[0], p2[1], p2[2]);
            const Real p(rng->uniform(0.0, 1.0)), q(rng->uniform(0.0, 1.0 - p));
            return (((P1 - P0) * p + (P2 - P0) * q + P0) + shift_) * ratio_;
        }
    }
    throw IllegalState("Never reach here.");
#else
    throw NotImplemented("not implemented yet.");
#endif
}
Example #4
0
void TF_SignerBase::InputRecoverableMessage(PK_MessageAccumulator &messageAccumulator, const byte *recoverableMessage, unsigned int recoverableMessageLength) const
{
	PK_MessageAccumulatorBase &ma = static_cast<PK_MessageAccumulatorBase &>(messageAccumulator);
	const MessageEncodingInterface &mei = GetMessageEncodingInterface();
	unsigned int maxRecoverableLength = mei.MaxRecoverableLength(MessageRepresentativeBitLength(), GetHashIdentifier().second, ma.AccessHash().DigestSize());

	if (maxRecoverableLength == 0)
		{throw NotImplemented("TF_SignerBase: this algorithm does not support messsage recovery or the key is too short");}
	if (recoverableMessageLength > maxRecoverableLength)
		throw InvalidArgument("TF_SignerBase: the recoverable message part is too long for the given key and algorithm");

	ma.m_recoverableMessage.Assign(recoverableMessage, recoverableMessageLength);
	mei.ProcessRecoverableMessage(
		ma.AccessHash(), 
		recoverableMessage, recoverableMessageLength,
		NULL, 0, ma.m_semisignature);
}
Example #5
0
std::unique_ptr<CanvasCommand> CanvasCommandFactory::create(CommandLine& commandLine)
{
    std::unique_ptr<CanvasCommand> canvasCommand;
    std::string nextToken;
    while ((nextToken = commandLine.nextToken()).length() > 0)
    {
        try
        {
            if (nextToken==CREATE_CANVAS_TOKEN)
            {
                canvasCommand.reset(new CreateCanvasCommand(commandLine.nextParameter(), commandLine.nextParameter()));
            }
            else if (nextToken==DRAW_LINE_TOKEN)
            {
                canvasCommand.reset(new DrawLineCommand(commandLine.nextParameter(), commandLine.nextParameter(), commandLine.nextParameter(), commandLine.nextParameter()));
            }
            else if (nextToken==DRAW_RECTANGLE_TOKEN)
            {
                canvasCommand.reset(new DrawRectangleCommand(commandLine.nextParameter(), commandLine.nextParameter(), commandLine.nextParameter(), commandLine.nextParameter()));
            }
            else if (nextToken==BUCKET_FILL_TOKEN)
            {
                canvasCommand.reset(new BucketFillCommand(commandLine.nextParameter(), commandLine.nextParameter(), commandLine.nextToken().at(0)));
            }
            else if (nextToken==QUIT_TOKEN)
            {
                // return null
            }
            else
            {
                throw NotImplemented("unknown command request");
            }
        }
        catch (std::logic_error& ex)
        {
            throw BadParameter("invalid parameter");
        }
    }
    return std::move(canvasCommand);
}
Example #6
0
Type* Op2::getTypeConstant() {
	switch (op) {
	case ADD:
	case SUB:
	case MUL:
	case DIV:
		return Type::higherType(left->getTypeConstant(), right->getTypeConstant());
	case LT:
	case GT:
	case LEQ:
	case GEQ:
	case EQ:
	case NEQ:
	case LOG_AND:
	case LOG_OR:
	case LOG_XOR:
		return &Type::Bool;
	default:
		throw NotImplemented(std::string("constant caculation ") + left->getTypeConstant()->getName() +
			OpNames[op] + right->getTypeConstant()->getName());
	}
}
Example #7
0
unsigned int RandomPool::TransferTo2(BufferedTransformation &target, unsigned long &transferBytes, const std::string &channel, bool blocking)
{
    if (!blocking)
        throw NotImplemented("RandomPool: nonblocking transfer is not implemented by this object");

    unsigned int t;
    unsigned long size = transferBytes;

    while (size > (t = pool.size() - getPos))
    {
        target.ChannelPut(channel, pool+getPos, t);
        size -= t;
        Stir();
    }

    if (size)
    {
        target.ChannelPut(channel, pool+getPos, size);
        getPos += size;
    }

    return 0;
}
Example #8
0
// virtual
LLSD LLHTTPNode::simplePost(const LLSD& input) const
{
	throw NotImplemented();
}
Example #9
0
TEST(PointCloudFactory, Default)
{
    NotImplemented();
}
Example #10
0
bool mime::HandlesEverything() const
{
    NotImplemented(_T("mime::HandlesEverything()"));
    return false;
}
Example #11
0
bool mime::CanHandleFile(const wxString& filename) const
{
    NotImplemented(_T("mime::CanHandleFile()"));
    return false;
}
Example #12
0
TEST(RenderOption, Default)
{
    NotImplemented();
}
Example #13
0
 void step(void)
 {
     throw NotImplemented("a step size must be specified.");
 }
Example #14
0
IntPoint ClipboardBal::dragLocation() const
{
    // OWB_PRINTF("ClipboardBal::dragLocation\n");
    NotImplemented();
    return IntPoint(0, 0);
}
Example #15
0
HashSet<String> ClipboardBal::types() const
{
    // OWB_PRINTF("ClipboardBal::types\n");
    NotImplemented();
    return HashSet<String>();
}
Example #16
0
void ClipboardBal::writeRange(Range*, Frame*)
{
    // OWB_PRINTF("ClipboardBal::writeRange\n");
    NotImplemented();
}
Example #17
0
bool ClipboardBal::hasData()
{
    // OWB_PRINTF("ClipboardBal::hasData\n");
    NotImplemented();
    return false;
}
Example #18
0
CachedImage* ClipboardBal::dragImage() const
{
    // OWB_PRINTF("ClipboardBal::dragImage\n");
    NotImplemented();
    return 0;
}
Example #19
0
TEST(RenderOptionWithEditing, Default)
{
    NotImplemented();
}
Example #20
0
void ClipboardBal::setDragImage(CachedImage*, const IntPoint&)
{
    // OWB_PRINTF("ClipboardBal::setDragImage\n");
    NotImplemented();
}
Example #21
0
TEST(GeometryRenderer, Default)
{
    NotImplemented();
}
Example #22
0
Node* ClipboardBal::dragImageElement()
{
    // OWB_PRINTF("ClipboardBal::dragImageElement\n");
    NotImplemented();
    return 0;
}
Example #23
0
int mime::OpenFile(const wxString& filename)
{
    NotImplemented(_T("mime::OpenFile()"));
    return -1;
}
Example #24
0
void ClipboardBal::setDragImageElement(Node*, const IntPoint&)
{
    // OWB_PRINTF("ClipboardBal::setDragImageElement\n");
    NotImplemented();
}
Example #25
0
	byte GenerateByte() {throw NotImplemented("NullRNG: NullRNG should only be passed to functions that don't need to generate random bytes");}
Example #26
0
DragImageRef ClipboardBal::createDragImage(IntPoint&) const
{
    // OWB_PRINTF("ClipboardBal::createDragImage\n");
    NotImplemented();
    return 0;
}
Example #27
0
// virtual
LLSD LLHTTPNode::simpleGet() const
{
	throw NotImplemented();
}
Example #28
0
void ClipboardBal::declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*)
{
    // OWB_PRINTF("ClipboardBal::declareAndWriteDragImage\n");
    NotImplemented();
}
Example #29
0
// virtual
LLSD LLHTTPNode::simpleDel(const LLSD&) const
{
	throw NotImplemented();
}
Example #30
0
void ClipboardBal::writeURL(const KURL&, const String&, Frame*)
{
    // OWB_PRINTF("ClipboardBal::writeURL\n");
    NotImplemented();
}